mysql5.6.46 installation tutorial

Uninstall Mariadb that comes with the system

rpm -qa|grep mariadb // Query the installed mariadb  
rpm -e --nodeps file name // uninstall mariadb, the file name is the file queried by the above command  
1. Download mysql to the opt file, unzip
tar -zxvf mysql5. 6.tar.gz

2. Copy the decompressed mysql directory to the local software directory of the system:

cp mysql5.6/ /usr/local/mysql -r
3. Add system mysql group and mysql user:

groupadd mysql
useradd -r -g mysql mysql
4. Enter the installation directory

cd /usr/local/mysql
5. Modify the owner of the current directory as the mysql user:

chown -R mysql:mysql ./
6. Install the database:

./scripts/mysql_install_db --user=mysql
If an installation error is reported, execute the following statement and install it again with
yum -y install autoconf
7. Modify the current directory owner as the root user:

chown -R root:root ./
8. Modify the owner of the current data directory as the mysql user

chown -R mysql:mysql data
9. Add boot start:

cp support-files/mysql.server /etc/init.d/mysql
10. Start the mysql service:

service mysql start
11. Put the mysql client in the default path:

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql The
above steps will complete the installation of mysql. There is no password by default. If you want to change the password, execute the following statement and write the password in single quotes

./bin/mysqladmin -u root password '123456'
If you want to modify all ip to connect, just do the following

1. Log in to mysql, press enter, enter the password and press enter, and press enter without a password

mysql -u root -p
2. Execute the following statement to release remote permissions

use mysql;
update user set host = '%' where user = 'root'  and host='localhost';
select host, user from user;

# Baidu’s, you can run the command again: update user set host ='localhost' where user ='root'; where "%" means that all machines are allowed to access the root user.

3. Exit the connection and restart

exit;
service mysql restart

Guess you like

Origin blog.csdn.net/qq_30264689/article/details/102776691