MySQL8.0.11的安装步骤
程序员文章站
2022-11-11 12:11:24
mysql8.0正式版8.0.11正式发布,意味该大版本已稳定正式可用。在这之前,我们已了解到该版本巨大的变化,为了一探究竟,咱们先来把装上。
使用的centos6.5
[root@dbtest...
mysql8.0正式版8.0.11正式发布,意味该大版本已稳定正式可用。在这之前,我们已了解到该版本巨大的变化,为了一探究竟,咱们先来把装上。
使用的centos6.5
[root@dbtest38 opt]# uname -a linux dbtest38 2.6.32-642.15.1.el6.x86_64
新建安装、数据库目录
mkdir /opt/mysql mkdir /data/mysql/mysql3306
新建mysql用户
groupadd mysql useradd -g mysql mysql
解压安装包
cd /opt/mysql tar zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz # v5.7 v8.0文件大小比较,8.0相对来说变小了 623m mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz 2.5g ./mysql-5.7.17-linux-glibc2.5-x86_64 1.3g ./mysql-5.7.17-linux-glibc2.5-x86_64/bin 575m mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz 1.8g ./mysql/mysql-8.0.11-linux-glibc2.12-x86_64 1.5g ./mysql/mysql-8.0.11-linux-glibc2.12-x86_64/bin
建立源文件链接ln -s /opt/mysql/mysql-8.0.11-linux-glibc2.12-x86_64 /usr/local/mysql
修改目录权限
chown -r mysql:mysql /usr/local/mysql chown -r mysql:mysql /opt/mysql chown -r mysql:mysql /data/mysql/mysql3306
配置简单的my.cnf
[root@dbtest38 mysql]# cat /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock [mysqld] port = 3306 user = mysql socket = /tmp/mysql.sock basedir = /usr/local/mysql datadir = /data/mysql/mysql3306/ log-error = error.log server-id = 330638
初始化数据库
# 有密码初始化 mysqld --defaults-file=/etc/my.cnf --initialize # 无密码初始化 mysqld --defaults-file=/etc/my.cnf --initialize-insecure
启动数据库mysqld --defaults-file=/etc/my.cnf &
获取数据库临时密码 ,登录数据库
[root@dbtest38 mysql3306]# cat error.log |grep password 2018-04-23t06:43:28.740843z 5 [note] [my-010454] [server] a temporary password is generated for root@localhost: woe5dj[root@dbtest38 mysql3306]# mysql -uroot -p enter password: welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 8 server version: 8.0.11 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. (product)root@localhost [(none)]> show databases; error 1820 (hy000): you must reset your password using alter user statement before executing this statement. # 第一次登录后需要修改root密码 (product)root@localhost [(none)]> alter user root@localhost identified by 'root'; query ok, 0 rows affected (0.08 sec) (product)root@localhost [(none)]> show databases; +--------------------+ | database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.07 sec)简单看了看数据目录下的文件,发现两个很有意思的问题:
# mysql库下权限等表不见了,v5.7版本前修改root密码的黑科技估计是用不了 [root@dbtest38 mysql3306]# ll /data/mysql/mysql3306/mysql total 28 -rw-r----- 1 mysql mysql 5521 apr 23 14:43 general_log_195.sdi -rw-r----- 1 mysql mysql 35 apr 23 14:43 general_log.csm -rw-r----- 1 mysql mysql 0 apr 23 14:43 general_log.csv -rw-r----- 1 mysql mysql 11746 apr 23 14:43 slow_log_196.sdi -rw-r----- 1 mysql mysql 35 apr 23 14:43 slow_log.csm -rw-r----- 1 mysql mysql 0 apr 23 14:43 slow_log.csv# 多了 mysql.ibd / .isd / .pem 等文件,undo从ibdata中拆分出来了 [root@dbtest38 mysql3306]# ll total 168016 -rw-r----- 1 mysql mysql 56 apr 23 14:43 auto.cnf -rw-r----- 1 mysql mysql 850 apr 23 15:46 binlog.000001 -rw-r----- 1 mysql mysql 16 apr 23 14:46 binlog.index -rw------- 1 mysql mysql 1680 apr 23 14:43 ca-key.pem -rw-r--r-- 1 mysql mysql 1112 apr 23 14:43 ca.pem -rw-r--r-- 1 mysql mysql 1112 apr 23 14:43 client-cert.pem -rw------- 1 mysql mysql 1680 apr 23 14:43 client-key.pem -rw-r----- 1 mysql mysql 5 apr 23 14:46 dbtest38.pid -rw-r----- 1 mysql mysql 969 apr 23 14:46 error.log -rw-r----- 1 mysql mysql 5927 apr 23 14:43 ib_buffer_pool -rw-r----- 1 mysql mysql 12582912 apr 23 15:46 ibdata1 -rw-r----- 1 mysql mysql 50331648 apr 23 15:46 ib_logfile0 -rw-r----- 1 mysql mysql 50331648 apr 23 14:43 ib_logfile1 -rw-r----- 1 mysql mysql 12582912 apr 23 14:46 ibtmp1 drwxr-x--- 2 mysql mysql 4096 apr 23 14:43 mysql -rw-r----- 1 mysql mysql 25165824 apr 23 15:46 mysql.ibd drwxr-x--- 2 mysql mysql 4096 apr 23 14:43 performance_schema -rw------- 1 mysql mysql 1676 apr 23 14:43 private_key.pem -rw-r--r-- 1 mysql mysql 452 apr 23 14:43 public_key.pem -rw-r--r-- 1 mysql mysql 1112 apr 23 14:43 server-cert.pem -rw------- 1 mysql mysql 1676 apr 23 14:43 server-key.pem drwxr-x--- 2 mysql mysql 4096 apr 23 14:43 sys -rw-r----- 1 mysql mysql 10485760 apr 23 15:46 undo_001 -rw-r----- 1 mysql mysql 10485760 apr 23 15:46 undo_002 drwxr-x--- 2 mysql mysql 4096 apr 23 15:46 yxli至于 8.0 的其他变化,等后续慢慢研究了,今天的安装篇就到这里了。
上一篇: 秋季多吃这3种食物 润肺防病又大补
下一篇: 秋季护肺吃什么 这物清肺效果一级棒