This article mainly from the following aspects of their own under the CENTOS7 installation Mysql8 process to do the following summary:
- CENTOS7 installation Mysql8 step;
- Window under the Navicat connection MySql8;
- The Linux commands involved
80039650
--------------------------------------------------------------------------------------------------------------- ---
The first part CentOS7 installation mysql1.1 The pre-installation cleaning work; 1.1.1 Clean up the original MySQL database;
Use the following command to find out the installed MySQL package and the dependent package:
rpm -pa | grep mysql
The results appear as follows:
- Mysql80-community-release-el7-1.noarch
- Mysql-community-server-8.0.11-1.el7.x86_64
- Mysql-community-common-8.0.11-1.el7.x86_64
- Mysql-community-libs-8.0.11-1.el7.x86_64
- Mysql-community-client-8.0.11-1.el7.x86_64
Use the following command to delete the above program in turn
yum remove mysql-xxx-xxx-
Delete the MySQL configuration file, uninstall does not automatically delete the configuration file, first use the following command to find out the use of the configuration file;
find / -name mysql
The possible display results are as follows:
- /etc/logrotate.d/mysql
- /etc/selinux/targeted/active/modules/100/mysql
- /etc/selinux/targeted/tmp/modules/100/mysql
- /var/lib/mysql
- /var/lib/mysql/mysql
- /usr/bin/mysql
- /usr/lib64/mysql
- /usr/local/mysql
Use the following command to delete the configuration file in turn, as required
rm -rf /var/lib/mysql
1.1.2 Delete mariadb files,
Since MySQL is charged in CentOS7, MySQL has not been supported, instead of CentOS7 internal integration of MARIADB, and the installation of MySQL will conflict with mariadb files, so you need to uninstall the MARIADB first.
Use the RPM command to find out the mariadb file to be deleted;
rpm -pa | grep mariadb
The possible display results are as follows:
mariadb-libs-5.5.56-2.el7.x86_64
Remove the above program
rpm -e mariadb-libs-5.5.56-2.el7.x86_64
You may see the following error message:
- Dependency detection failure:
- libmysqlclient.so.18 () (64bit) was (installed) postfix-2:2.10.1-6.el7.x86_64 required
- libmysqlclient.so.18 (libmysqlclient_18) (64bit) was (installed) postfix-2:2.10.1-6.el7.x86_64 needed
- libmysqlclient.so.18 (libmysqlclient_18) (64bit) was (installed) postfix-2:2.10.1-6.el7.x86_64 needed
Use force Delete:
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
At this point, the original MySQL and mariadb database deleted;
1.2 Installing mysql1.2.1 MySQL repo source available under MySQL website
CentOS's Yum source is not MySQL by default, so we need to go to the official website to download MySQL repo source and install it;
MySQL website download link: MySQL repo as follows:
1.2.2 uploading files to CentOS using Putty's PSCP
Use putty to upload the F: Disk just under the good MySQL repo file to the Centos/usr/local/mysql folder;
D:\Putty>pscp F:\mysql80-community-release-el7-1.noarch.rpm [email protected]:/usr/local/mysql/
1.2.3 Install the Yum repo file and update the Yum cache;
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
Execution Result:
Two repo files are generated under the/etc/yum.repos.d/directory Mysql-community.repo Mysql-community-source.repo
Update Yum command
- Yum Clean All
- Yum Makecache
1.2.4 Installing MySQL with yum
When we install MySQL with yum, Yum installs MySQL's newest GA version from the Yum repository by default, and how to choose its own version;
Step one: View the MySQL version in the MySQL Yum repository using the following command
yum repolist all | grep mysql
You can see that MySQL 5.5 5.6 5.7 is disabled and MySQL 8.0 is enabled;
The second step uses the Yum-config-manager command to modify the appropriate version to enable the latest version to disable the state
- Yum-config-manager--disable mysql80-community
- Yum-config-manager--enable mysql57-community
Or you can edit the MySQL repo file,
Change the corresponding version of enabled to 1;
1.2.5 Install the MySQL command as follows:
yum install mysql-community-server
1.2.6 turn on MySQL service
systemctl start mysqld.service
1.2.7 Get initial password login MySQL
MySQL will create an [email protected] account after installation, and put the initial password in the/var/log/mysqld.log file;
cat /var/log/mysqld.log | grep password
Log in to MySQL with the initial password
Modify the initial password: So the password you just started must match the length and must contain numbers, lowercase or uppercase letters, special characters.
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
1.2.8 Open Port 3306 in the firewall
CentOS7 default is to use firewall as a firewall, I changed here to become accustomed to the common iptables firewall
First step: Turn off firewall firewall
- Systemctl Stop Firewalld.service
- Systemctl Disable Firewalld.service
- Systemctl Mask Firewalld.service
Step Two: Install the iptables firewall
yum install iptables-services -y
Step three: Start iptable firewall
- Systemctl Enable Iptables
- Systemctl start iptables
Fourth Step: Edit Firewall Add port Firewall file location:/etc/sysconfig/iptables
vim /etc/sysconfig/iptables
Add on the third line to the bottom
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
Fifth Step: Restart the firewall
- Systemctl Enable Iptables.service
- Systemctl Start Iptables.service
1.2.9 Add the MySQL service to the boot entry and start the MySQL process
- Systemctl Enable Mysqld.service
- Systemctl Start Mysqld.service
Common MySQL service commands:
- Log in to MySQL
- Mysql-u username-p
- Quit MySQL
- Quit
- Start MySQL
- Systemctl Start Mysqld.service
- End
- Systemctl Stop Mysqld.service
- Restart
- Systemctl Restart Mysqld.service
- Power-on self-booting
- Systemctl Enable Mysqld.service
- View MySQL version
- Select version ();
This section references the documentation:
Reference 1:centos Installing MySQL
Literature 2:a Quick Guide to Using the MySQL Yum Repository
--------------------------------------------------------------------------------------------------------------- ---
Part Two Navicat connection Mysql82.1 turn on MySQL remote service: 2.1.1 Modify the value of host in the user table under MySQL database
It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host" entry, from "localhost" to "%" log into the MySQL database to execute the following command:
- Mysql-u root-p
- Use MySQL;
- Update user set host= '% ' where user= ' root ';
2.1.2 How to use authorization
Give any host access to data
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES
If you want to myuser users to use the MyPassword password from any host to connect to the MySQL server.
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.6 and use MyPassword as the password
GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
2.2 The following error is reported when using Navicat for MySQL to connect MySQL 8.0:
mysql8.0 introduces a new feature Caching_sha2_password; This encryption method is not supported by the client, and the client supports Mysql_native_password.
We can view the plugin field of the user table in the MySQL database;
You can use the command to change him to Mysql_native_password encryption mode:
update user set plugin=‘mysql_native_password‘ where user=‘root‘;
Then use Navicat link can link success;
This section refers to the following articles:
Reference 1:mysql two ways to open a remote
Reference 2: Initial installation of MySQL encountered problems
--------------------------------------------------------------------------------------------------------------- ---
The third part: The Linux command learning involved in the installation process;
3.1 rpm
3.2 Putty upload file PSCP command;
On the window machine CD into the Pttty installation directory:
cd :\program files (x86)\Putty
Copy local files to Linux : PSCP file User name @linuxip: directory
pscp hello.txt [email protected]:/tmp/userfile/
Copy the local folder to Linux:pscp-r directory user name @linuxip: directory
pscp -r c:\file [email protected]:/root/testFolder
Copy the file \root\test.txt on Linux to the local C-drive src folder as follows:
pscp [email protected]_pc:/root/test.txt C:\src
3.3 Modifying Firewall files/etc/sysconfig/iptables
3.4 systemctl Command
CentOS7 installation Mysql8