[iyunv@rhel7 ~]# ls -l mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--. 1 root root 548193637 Dec 4 21:16 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
3、添加mysql用户和组
1
2
3
4
[iyunv@rhel7 ~]# groupadd mysql
[iyunv@rhel7 ~]# useradd -r -g mysql -s /bin/false mysql
[iyunv@rhel7 ~]# id mysql
uid=996(mysql) gid=1000(mysql) groups=1000(mysql)
4、创建目录、改属组及解压文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[iyunv@rhel7 ~]# mkdir -p /opt/mysql/
[iyunv@rhel7 ~]# mkdir /mysqldata
[iyunv@rhel7 ~]# mv /root/mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz /opt/mysql/
[iyunv@rhel7 ~]# cd /opt/mysql/
[iyunv@rhel7 mysql]# ls
mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
[iyunv@rhel7 mysql]# tar -zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
......
[iyunv@rhel7 mysql]# mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql5.7.11
[iyunv@rhel7 mysql]# ls -l
total 535352
drwxr-xr-x. 9 7161 wheel 4096 Feb 2 2016 mysql5.7.11
-rw-r--r--. 1 root root 548193637 Dec 4 21:16 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
[iyunv@rhel7 mysql]# chown mysql:mysql -R /opt/mysql/
[iyunv@rhel7 mysql]# chown mysql:mysql -R /mysqldata/
5、初始化库
1
2
3
4
5
6
7
8
9
10
[iyunv@rhel7 mysql]# cd mysql5.7.11/
[iyunv@rhel7 mysql5.7.11]# ./bin/mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql5.7.11/ --datadir=/mysqldata/
2016-12-04T13:33:01.318081Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-04T13:33:01.729086Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-12-04T13:33:02.027182Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-12-04T13:33:02.111882Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 2dca0cf3-ba26-11e6-b4ff-080027e818bc.
2016-12-04T13:33:02.118970Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-12-04T13:33:02.120080Z 1 [Note] A temporary password is generated for root@localhost: rqwPw!9iNEEP
[iyunv@rhel7 mysql5.7.11]# ls /mysqldata/
auto.cnf ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema sys
[iyunv@rhel7 mysql5.7.11]# ./bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.11
Copyright (c) 2000, 2016, 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> set password='1qaz!QAZ';
Query OK, 0 rows affected (0.01 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'SET PASSWORD = PASSWORD('<plaintext_password>')' is deprecated and will be removed in a future release. Please use SET PASSWORD = '<plaintext_password>' instead |
+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)