Chinaunix首页 | 论坛 | 博客
  • 博客访问: 780986
  • 博文数量: 99
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1163
  • 用 户 组: 普通用户
  • 注册时间: 2016-09-22 09:50
个人简介

一个守望数据库的老菜鸟

文章分类

全部博文(99)

文章存档

2019年(21)

2018年(17)

2017年(37)

2016年(24)

我的朋友

分类: Mysql/postgreSQL

2018-05-06 08:06:00

博客文章除注明转载外,均为原创。转载请注明出处。
本文链接地址:http://blog.chinaunix.net/uid/31396856.html

MySQL 8.0.11以及GA了,现在开始从MySQL 5.7进入8的时代了。看到官网介绍的很多新特性,感觉安装一个数据库开始学习吧
1、卸载mysql老版本
rpm -qa|grep mysql
rpm -e qt-mysql-4.6.2-28.el6_5.x86_64
rpm -e dovecot-mysql-2.0.9-22.el6.x86_64
rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
rpm -e mysql-devel-5.1.73-7.el6.x86_64
rpm -e mysql-server-5.1.73-7.el6.x86_64 
rpm -e --nodeps mysql-server-5.1.73-7.el6.x86_64 
rpm -e mysql-5.1.73-7.el6.x86_64
rpm -e --nodeps qt-mysql-4.6.2-28.el6_5.x86_64
rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64

2、安装依赖包
yum install gcc gcc-c++ libaio 

3、下载软件包并解压
tar -zxf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz -C /opt/mysql

4、创建软连接
 cd /usr/local/
 ln -sv /opt/mysql/mysql-8.0.11-linux-glibc2.12-x86_64 mysql

5、创建用户和组
 groupadd -g 301 mysql
 useradd -g 301 -r -s /bin/nologin -u 301 mysql

6、相关目录结构和权限
 chown -R mysql:mysql /usr/local/mysql
 mkdir -p /data
 mkdir -p /data/mysql/data
 mkdir -p /data/mysql/log/binlogs
 mkdir -p /data/mysql/log/slowlogs
 mkdir -p /data/mysql/log/relaylogs
 mkdir -p /data/mysql/undo
 mkdir -p /data/mysql/redologs
 mkdir -p /data/mysql/tmp
 chown -R mysql:mysql/data/mysql

7、环境变量配置
  echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
  source /etc/profile
8、添加启动服务
  cp support-files/mysql.server /etc/init.d/mysqld

9、my.cnf配置


10、初始化数据库:
两种方式
 bin/mysqld --initialize --user=mysql
 bin/mysqld  --initialize-insecure --user=mysql 
 
我这里采用非认证加密方式  
[root@dbwatcher mysql]#   bin/mysqld  --initialize-insecure --user=mysql 
[root@dbwatcher mysql]# more /data/mysql/logs/mysql-error.log 
2018-05-04T07:10:50.265003Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use 
binlog_expire_logs_seconds instead.
2018-05-04T07:10:50.265211Z 0 [System] [MY-013169] [Server] /opt/mysql/mysql-8.0.11-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.11) initializing of server 
in progress as process 28501
 100
 100 200
 100 200
 100 200
2018-05-04T07:10:58.852234Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initializ
e-insecure option.
2018-05-04T07:11:00.109123Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109181Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109228Z 5 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109272Z 5 [Warning] [MY-010315] [Server] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109305Z 5 [Warning] [MY-010323] [Server] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109330Z 5 [Warning] [MY-010323] [Server] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109348Z 5 [Warning] [MY-010311] [Server] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109487Z 5 [Warning] [MY-010330] [Server] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:00.109533Z 5 [Warning] [MY-010330] [Server] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-05-04T07:11:01.059233Z 0 [System] [MY-013170] [Server] /opt/mysql/mysql-8.0.11-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.11) initializing of server 
has completed
已经配置完成,启动数据库。

[root@dbwatcher mysql]# /etc/init.d/mysqld start
Starting MySQL....                                         [  OK  ]
[root@yangdong_ceshi mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11 MySQL Community Server - GPL


Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


(root@localhost:)[(none)]> 
(root@localhost:)[(none)]> \s
--------------
mysql  Ver 8.0.11 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)


Connection id: 8
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.11 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db     characterset: utf8
Client characterset: utf8
Conn.  characterset: utf8
UNIX socket: /data/mysql/tmp/mysql.sock
Uptime: 9 sec


Threads: 2  Questions: 7  Slow queries: 0  Opens: 113  Flush tables: 2  Open tables: 89  Queries per second avg: 0.777
--------------

---The end
阅读(4021) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~