mysql8.0 deployment, initialization, and creation of instances
Environmental information:
CentOS 7.4.1708
MySQL 8.0.11
1. Download the uncompressed MySQL package
cd /usr/local/wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gztar xzvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gzmv mysql-8.0.11-linux-glibc2.12-x86_64 mysql
2. Initializing MySQL Basic environment information
vim /etc/profilePATH=/opt/mysql/bin:/opt/mysql/lib:$PATHexport PATHexport MYSQL_HOME="/opt/mysql"export ms="/opt/mysql"
3. Initializing the configuration instance configuration file
mkdir -p /opt/mysql/data/mcdbvi /opt/mysql/data/my.cnf
[client]port = 3311socket = /opt/mysql/data/mcdb/mysql.sock[mysql]no-auto-rehash[mysqld]user = mysqlport = 3311socket = /opt/mysql/data/mcdb/mysql.sockbasedir = /opt/mysqldatadir = /opt/mysql/datapid-file = /opt/mysql/data/mcdb/mysql.pidrelay-log = /opt/mysql/data/mcdb/relay-binrelay-log-info-file = /opt/mysql/data/mcdb/relay-log.infoserver-id = 13[mysqld_safe]log-error = /opt/mysql/data/mcdb/mysql.errpid-file = /opt/mysql/data/mcdb/mysql.pid
4. Create a new user
groupadd mysqluseradd mysql -g mysqlchown mysql:mysql /opt/mysql -R
5. Initializing MySQL instance
/opt/mysql/bin/mysqld --initialize --basedir=/opt/mysql --datadir=/opt/mysql/data/mcdb --user=mysql
Get the password from the last line of the return message, for a chestnut:
xhgkgc+9ea6/
6. Start the instance MySQL
mv /opt/mysql/data/my.cnf /opt/mysql/data/mcdb/my.cnf/opt/mysql/bin/mysqld_safe --defaults-file=/opt/mysql/data/mcdb/my.cnf --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data/mcdb 2>&1 > /dev/null &
7. Log in to MySQL
/opt/mysql/bin/mysql -uroot -pxHGkgc+9ea6/ -S /opt/mysql/data/mcdb/mysql.sock
8. Set a new password
set password = ‘hello2018‘;
mysql8.0 deployment, initialization, and creation of instances