Install mysql 5.7.13 and mysql 5.7.13 in VMWare linux
1. Basic Environment Description
Virtual Machine: VMWare
Operating System: linux
Database Version: mysql 5.7.13 community edition (do not ask why the Enterprise Edition is not installed because the Enterprise Edition requires money)
Background: virtual machines can connect to the Internet
2. Understanding
Check whether mysql is installed on linux.
① Start service mysqld start
Prompt if no installation is available
② Check whether the service exists in chkconfig -- list mysqld on linux
Prompt if no installation is available
3. Create the/tools directory (store the downloaded file to this directory) and go to the/tools directory.
# Mkdir/tools
# Cd/tools
4. Download mysql 5.7.13
# Wget http://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
5. decompress the package
# Tar-xzf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
6. create directory/data/mysql (installation directory)
# Cd/
# Mkdir data
# Cd/data
# Mkdir mysql
7. Create a mysql user, group, and Directory
# Groupadd mysql
# Useradd-r-s/sbin/nologin-g mysql-d/tools/mysql-5.7.13-linux-glibc2.5-x86_64
8. Switch the Directory and grant permissions
# Cd/tools/mysql-5.7.13-linux-glibc2.5-x86_64
# Pwd
# Chown-R mysql.
# Chgrp-R mysql.
# Chown-R mysql/data/mysql
If Step 6-8 is not performed, the following error occurs: bin/mysqld: no such file or directory.
9. set parameters
# Bin/mysqld -- initialize -- user = mysql -- basedir =/tools/mysql-5.7.13-linux-glibc2.5-x86_64 -- datadir =/data/mysql
Note: Remember the temporary password in the red box and will be used later.
# Bin/mysql_ssl_rsa_setup -- datadir =/data/mysql
10. modify the configuration file
# Cd support-files
# Cp my-default.cnf/etc/my. cnf
# Cp mysql. server/etc/init. d/mysql
# Vim/etc/init. d/mysql
Modify the following content:
# Vim/etc/my. cnf
Modify the following content:
After modification, you 'd better check it again. Sometimes misspelling may cause many messy errors.
11. Start mysql
Note: Check whether the path used in the my. cnf configuration file exists. If the path does not exist, create it by yourself.
# Bin/mysqld_safe -- user = mysql &
Bin/mysql -- user = root-p
-- Enter the temporary password generated in step 1
12. Modify the root password
Mysql> set password = password ('20140901'); -- enter the new password
13. Grant Permissions
Mysql> grant all privileges on *. * to 'root' @ '% 'identified by '123 ';
Mysql> flush privileges;
14. j check results
Mysql> use mysql;
Mysql> select host, user from user;
Mysql> exit;
15. Add the system path
# Vim/etc/profile
Add:
Export PATH =/usr/local/mysql/bin: $ PATH
# Source/etc/profile
16. Configure mysql auto-start
# Chmod 755/etc/init. d/mysql
# Chkconfig -- add mysql
# Chkconfig -- level 345 mysql on
Most of the above configuration reference http://www.cnblogs.com/zhao1949/p/5947938.html