First, download mysql5.7
http://mirrors.sohu.com/mysql/MySQL-5.7/
Linux Downloads:
Input command:wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
second, the establishment of users, as well as the MySQL directory
1. Set up a MySQL group
Input command: groupadd MySQL
2. Build MySQL user and put it into MySQL group
Input command:useradd-r-g MySQL MySQL
3. Set password for MySQL user
Input command:passwd MySQL
third, decompression MySQL
1. Move the downloaded MySQL package to the Linux virtual machine
2. Copy the tar package to the/usr/local directory
Input command:mv/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz/usr/local
3. Decompression
Input command:cd/usr/local
Input command:tar xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
4. Change the extracted file name to MySQL
Input command:mv mysql-5.7.17-linux-glibc2.5-x86_64 MySQL
Iv. configuration-related boot configuration files
1. Copy my_default.cnf to/ETC/MY.CNF (automatically read when MySQL starts)
Input command:CP my-default.cnf/etc/my.cnf
2, solve garbled problem
Input command:vi/etc/my.cnf
Change:
?
12345 |
[mysql] default-character- set =utf8 [mysqld] default-storage-engine=INNODB character_set_server=utf8 |
3, copy Mysql.server to/etc/init.d/
Input command:CP mysql.server/etc/init.d/mysql
4, modify the/etc/init.d/mysql parameter, give 2 directory location
Input command:vi/etc/init.d/mysql
Change:basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
5, to the directory/usr/local/mysql change owner
Input command:chown-r mysql:mysql/usr/local/mysql/
v. Initialize the MySQL database
1. Initialize the database
The first thing to do is to go to the Mysql/bin directory
Old version of the command:mysql_install_db
New version of the command :./mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
Generate a data directory that represents the successful initialization of the database
2. Encrypt the database
Input command: ./mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data
3. Start MySQL
Input command:./mysqld_safe--user=mysql &
& symbols: Throw the current process to the background
Vi. entering the client
1. Login
Input command:./mysql-uroot–p
and enter your temporary password.
2, at this time the root user does not lose password login error, need to change the configuration file, and then restart the MySQL
Input command:vi/etc/my.cnf
Add to
[Mysqld]
skip-grant-tables
Input command:service mysql Restart
3. Change the password
Input command:set Password=password (' Your password ');
vii. Windows remote access to Linux virtual machine MySQL
1, first to shut down the firewall, so that window can connect to the
Input command:systemctl stop Firewalld.service
2. Authorization to Window
Input command:grant all privileges on * * to [email protected] '% ' identifiedby ' 123456 ';
3. Window Remote Connection
Input command:mysql–hip address-uroot-p123456
Eight, set the boot automatically start the MySQL service
1. Add service MySQL
Input command:chkconfig--add MySQL
2. Set up service start-up
Input command:chkconfig MySQL on
ix. Setting the PATH environment variable
Input command:vi/etc/profile
Set environment variables:export path= $JAVA _home/bin:/usr/local/mysql/bin: $PATH
10. Complete
So our MySQL database is configured.
The above is the whole content of this article, I hope that everyone's learning has helped, but also hope that we support the script home.
Reference Posts:
Sprinkler, Blink.
Troubleshoot MySQL login error
Linux virtual machine under MySQL 5.7 installation configuration method graphic Tutorial