Install MySQL under Linux 5.7. Version 22
1, with rpm-qa | grep mysql view current rpm installed MySQL version
2. Uninstall the MySQL version of the system default RPM installation
use the rpm-e--nodeps mysql-libs-5.1.73-7.el6.x86_64 command to uninstall the MySQL version of the system default RPM installation
3. Download Linux on the website
Website address: https://dev.mysql.com/downloads/mysql/5.7.html#downloads
4, select the installation version, System. System version
5, with the WinSCP tool, the downloaded mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz transferred to the Linux server under the OPT directory (OPT is equivalent to window d:// Software storage of third party packages)
6. Unzip the package into the/user/local/mysql directory
TAR-ZXVF/OPT/MYSQL-5.7.22-LINUX-GLIBC2.12-X86_64.TAR.GZ//Decompression pack mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
MV Mysql-5.7.22-linux-glibc2.12-x86_64/usr/local/mysql//Cut the unpacked compressed package into the/usr/local/mysql directory
7. Create user group MySQL
Groupadd MySQL//create user group MySQL
8. Create user MySQL and add to user group MySQL
useradd-g MySQL mysql//create user and add to user group MySQL
9. Go to MySQL decompression path and modify the owner and owning group under MySQL directory
Chown-r mysql:mysql.///recursively modify the owner and owning group of the current directory
10. Installation and initialization of the database
Bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data//install and initialize database
Remember the temporarily generated password, such as the last line of W2:6f7tg63ij
11. Install SSL
Bin/mysql_ssl_rsa_setup//Install SSL, default certificate installed under environment variable DataDir
12. Copy the/usr/local/mysql/support-files/mysql.server to/etc/init.d/mysql and set the run permissions so you can start/stop services using the service MySQL command
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql//Will/usr/local/mysql/support-files/mysql.server Copy as/etc/init.d/mysql
chmod +x/etc/init.d/mysql//Set /etc/init.d/mysql Run permissions
13. Add the MySQL service to the boot entry
Chkconfig--add mysql//register MySQL service for boot entry
Chkconfig--list MySQL//Check if registration is successful, I installed the system is running at 3 level
14. Start MySQL
Service MySQL start//The previous step has copied the boot script/usr/local/mysql/support-files/mysql.server to/etc/init.d/mysql, so you can start it like this
15, connect MySQL, password is the password of step 10 initialization
./mysql-uroot-p//Connect MySQL
16. Change the password
Alter user ' root ' @ ' localhost ' identified by ' root '; The first root is the account number, the second root is the new password set
17. Set up remote connection to MySQL and refresh permissions
Linux for security, the default is not to allow machines outside the MySQL server to access the native MySQL database service, you need to re-authorize the root account to provide remote access:
Grant all privileges on * * to [email protected] '% ' identified by ' root '; Re-authorize the root account to provide remote access
Format: Grant all privileges the on library name. Table name to ' user name ' @' IP address ' identified by ' password ' with grant option; flush privileges;
Supplemental Note: library name: The name of the database to be accessed remotely, all databases using "*"
Table name: The name of the table under the database to be accessed remotely, all tables using "*"
Username: The name of the user to assign to the remote access permission
IP address: The IP address of the computer that can be accessed remotely, using "%" for all addresses
Password: the password that is used by the user to be assigned to the remote access permission
Flush privileges; Refresh Permissions
See if it's successful
Select Host,user from Mysql.user; Find a user table
18. Exit
Quit//Quit MySQL interface
Added: Mysqld_safe adds some security features, such as restarting the server when an error occurs and writing run time information to the error log file, which is more than one process
Linux Common development environment software-mysql installation