此次演示的是mysql 8.0.11的安装、启动与基本设置。 下载mysql-8.0.11-el7-x86_64.tar.gz
1. Unzip and rename
[Email protected] ~]# Cd/data
[[email protected] data]# ls
Mysql-8.0.11-el7-x86_64.tar.gz
[Email protected] data]# TAR-ZXF mysql-8.0.11-el7-x86_64.tar.gz
[[Email protected] data]# mv mysql-8.0.11-el7-x86_64 MySQL
2. Create a MySQL user
[[email protected] data]# useradd-m-s/sbin/nologin MySQL
3. Initialize the database
[Email protected] data]# CD mysql/
[Email protected] mysql]#/bin/mysqld--initialize--user=mysql--datadir=/data/mysql/data
2018-04-26t03:06:01.637456z 0 [Warning] [MY-011070] [Server] ' disabling symbolic links using--skip-symbolic-links (or EQ Uivalent) is the default. Consider not using the this option as it's deprecated and would be removed in a future release.
2018-04-26t03:06:01.637709z 0 [System] [MY-013169] [Server]/data/mysql/bin/mysqld (mysqld 8.0.11) initializing of Server in progress as process 53030
2018-04-26T03:06:17.384428Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: *wbnbphswv8>K*此为数据库初始密码 2018-04-26T03:06:26.959938Z 0 [System] [MY-013170] [Server] /data/mysql/bin/mysqld (mysqld 8.0.11) initializing of server has completed
4. Edit the configuration file
[Email protected] mysql]# VIM/ETC/MY.CNF
[Client]
Port = 3306
Socket =/tmp/mysql.sock
[mysqld] datadir=/data/mysql/data socket=/tmp/mysql.sock port=3306 user=mysql basedir=/data/mysql symbolic-links=0 [mysqld_safe] log-error=/data/mysql/data/error.log pid-file=/data/mysql/data/mysql.pid
5, start
[[email protected] mysql]#./bin/mysqld--defaults-file=/etc/my.cnf &
[1] 53216
[[Email protected] mysql]# 2018-04-26t03:18:05.050872z 0 [Warning] [MY-011070] [Server] ' disabling symbolic links using--s Kip-symbolic-links (or equivalent) is the default. Consider not using the this option as it's deprecated and would be removed in a future release.
2018-04-26t03:18:05.051064z 0 [System] [MY-010116] [Server]/data/mysql/bin/mysqld (mysqld 8.0.11) starting as Process 53216
2018-04-26t03:18:06.208674z 0 [Warning] [MY-010068] [Server] CA certificate Ca.pem is self signed.
2018-04-26t03:18:06.240611z 0 [System] [MY-010931] [Server]/data/mysql/bin/mysqld:ready for connections. Version: ' 8.0.11 ' socket: '/tmp/mysql.sock ' port:3306 mysql Community server-gpl.
6. Review the process
[[Email protected] mysql]# PS aux| grep MySQL
Qiang 10783 0.0 0.2 165020 4452 pts/0 s+ 14:38 0:00/data/mysql/bin/mysql-uroot-p
Qiang 12866 0.0 0.0 112664 972 pts/1 r+ 15:19 0:00 grep--color=auto MySQL
Root 14040 0.0 0.0 113252 1528? S August 0:00/bin/sh/data/mysql/bin/mysqld_safe--datadir=/data/mysql/data--pid-file=/data/mysql/data/baobao.pid
MySQL 14231 0.3 20.3 1365424 382536? Sl August 14:47/data/mysql/bin/mysqld--basedir=/data/mysq--datadir=/data/mysql/data--plugin-dir=/data/mysql/lib/ Plugin--user=mysql--log-error=/data/mysql/data/mysql_error.log--pid-file=/data/mysql/data/baobao.pid--socket=/ Tmp/mysql.sock--port=13306
7. Set Startup script
[email protected] mysql]# CP./support-files/mysql.server/etc/init.d/mysqld
modifying startup Parameters
[Email protected] mysql]# Vi/etc/init.d/mysqld
Basedir=/data/mysql
Datadir=/data/mysql/data
8. Close and start
Stop it
[[email protected] data]#/etc/init.d/mysqld stop
Shutting down MySQL ... success!
Start
[[email protected] ~]#/etc/init.d/mysqld start
Starting MySQL .... success!
9. Simple Database Setup
[Email protected] mysql]#./bin/mysql-uroot-p
Enter password:wbnbphswv8>k
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 9
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. mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> alter user [email protected] identified by ‘123123‘; Query OK, 0 rows affected (0.14 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.10 sec) mysql>
mysql8.0.11 installation, startup and basic setup