This article records the MySQL 5.7.14 installation configuration code, details as follows
Os:centos 6.6
Db:mysql 5.7.14
1. Download MySQL
Cd/tools
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
2. Create a MySQL binary extract file directory
Mkdir-p/opt/mysql
[root@zw-test-db mysql]# cd/tools/
[root@zw-test-db tools]# ll-l Mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--1 root 642694570 Aug 29 15:02 Mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
3. Extract to/opt/mysql directory
[Root@zw-test-db tools]# cd/opt/mysql/
[root@zw-test-db mysql]# tar-zxvf/tools/mysql-5.7.14-linux-glibc2.5-x86 _64.tar.gz
[root@zw-test-db mysql]# mv mysql-5.7.14-linux-glibc2.5-x86_64/mysql-5.7.14
[root@zw-test-db mysql]# ll
drwxr-xr-x 9 7161 31415 4096 June 21:03
4. Create a soft connection to/usr/local
[Root@zw-test-db mysql]# cd/usr/local/
[root@zw-test-db local]# ls
bin etc games include Lib Lib64 libexec redis- 3.2.2 Sbin share src
[root@zw-test-db local]# ln-s]/opt/mysql/mysql-5.7.14/usr/local/mysql
[ Root@zw-test-db local]# ll MySQL
lrwxrwxrwx 1 root Aug to 17:36 MySQL->/opt/mysql/mysql-5.7.14
[roo T@zw-test-db local]#
5. Create User
[root@zw-test-db/]# groupadd mysql
[root@zw-test-db/]# useradd-m-G mysql-s/sbin/nologin-d-/usr/local/mysql mysq L
-S Nologin no shell cannot log in
6. Create a basic directory based on the configuration file
Mkdir/data/mysql
mkdir/data/mysql/mysql_3306
cd/data/mysql/mysql_3306/
mkdir data
mkdir logs
mkdir tmp
chown-r mysql:mysql/data/mysql/mysql3306
7. Create/ETC/MY.CNF configuration file (procedure slightly)
8. Initialize,5.7 initialization will add a default password
[Root@zw-test-db mysql]# cd/usr/local/mysql/
[root@zw-test-db mysql]#./bin/mysqld--initialize
[ Root@zw-test-db data]# pwd
/data/mysql/mysql_3306/data
### Below are 5.5, 5.6 initialization
/usr/local/mysql/scripts/ mysql_install_db--user=mysql--basedir=/usr/local/mysql
9. Check the error log, see if there is error
Cd/data/mysql/mysql_3306/data [root@zw-test-db data]# vim Error.log [root@zw-test-db data]# tail-f error.log 2016-08-31t09:44:32.394657z 0 [note] Giving 0 client threads a chance to die gracefully 2016-0 8-31t09:44:32.394680z 0 [note] shutting down slave threads 2016-08-31t09:44:32.394686z 0 [note] forcefully disconnecting 0 remaining clients 2016-08-31t09:44:32.415409z 0 [note] binlog end 2016-08-31t09:44:32.434217z 0 [note] innodb:fts opt
Imize thread exiting.
2016-08-31t09:44:32.434293z 0 [note] innodb:starting shutdown ...
2016-08-31t09:44:32.534587z 0 [note] innodb:dumping buffer pool (s) to/data/mysql/mysql_3306/data/ib_buffer_pool 2016-08-31t09:44:32.534741z 0 [note] innodb:buffer pool (s) dump completed at 160831 17:44:32 2016-08-31t09:44:34.308784z 0 [note] Innodb:shutdown completed;
Log sequence number 2525428 2016-08-31t09:44:34.308945z 0 [note] innodb:removed temporary tablespace data file: "IBTMP1"
10. View initialization Password
[root@zw-test-db data]# grep password Error.log
2016-08-31t09:44:21.172167z 1 [note] A temporary password are generated for root@localhost:8aahkrkxfm%t
The password is: 8aahkrkxfm%t
11 Creating a startup script
[Root@zw-test-db data]# cd/usr/local/mysql/
[Root@zw-test-db mysql]# CP Support-files/mysql.server/etc/init.d/mysql
Cp:overwrite '/etc/init.d/mysql '? Y
12. Three ways to start MySQL
Mode one:
Root@zw-test-db bin]#./mysqld_safe--user=mysql &
[1] 12455
[root@zw-test-db bin]# 160830 15:18:01 mysqld_ Safe Logging to '/usr/local/mysql/data/zw-test-db.err '.
160830 15:18:01 Mysqld_safe starting mysqld daemon with databases From/usr/local/mysql/data
Mode two:
[root@zw-test-db bin]#/etc/init.d/mysqld restart
shutting down MySQL. 160830 15:18:14 mysqld_safe mysqld from PID file/usr/local/mysql/data/zw-test-db.pid ended
[OK]
starting MySQL . [OK]
[1]+ done ./mysqld_safe--user=mysql
mode three:
[root@zw-test-db bin]# service mysqld Restart
shutting down MySQL. [OK]
Starting MySQL. [OK]
[Root@zw-test-db bin]#
13. Add Environment variables
echo "Export path=\ $PATH:/usr/local/mysql/bin" >>/root/.bash_profile
Source/root/.bash_profile
14. Landing
[Root@zw-test-db mysql]# mysql-u root-p
Enter Password:
Welcome to the MySQL monitor. Commands End With; or \g.
Your MySQL Connection ID is 3
Server version:5.7.14-log
Copyright (c), 2016, Oracle and/or its affiliates. A ll rights reserved.
Oracle is a registered trademark to Oracle Corporation and/or its
affiliates. The other names may is trademarks of their respective
owners.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Root@localhost [(none)]>show databases; --Prompt to modify password
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement .
15. Change Password
Root@localhost [(None)]>alter user User () identified by ' 123456 ';
Query OK, 0 rows Affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows Affected (0.00 sec)
Root@localhost [None]]>show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| MySQL |
| performance_schema |
| sys |
+--------------------+
4 rows in Set (0.00 sec)
You can view the database
16.5.6 Version before the need to secure the account security,5,7 after the test database is not
Delete from Mysql.user where user!= ' root ' or host!= ' localhost '; --Delete non-root user, landing host is not localhost account
flush privileges;
Alter user user () identified by ' 123456 ';
drop database test;
Truncate MYSQL.DB;
Wonderful topic sharing: MySQL different versions of the installation Tutorials mysql5.7 version Installation Tutorials
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.