1. Install MySQL
The MySQL series database is installed by default in CentOS7 and needs to be uninstalled first.
To view the currently installed MARIADB package:
[Email protected] desktop]# Rpm-qa | grep mariadb
Remove them all forcibly:
[Email protected] Desktop]# rpm-e--nodeps mariadb-libs-5.5.35-3.el7.x86_64
Download RPM installation package on official website, http://dev.mysql.com/downloads/mysql/, unzip after download is complete.
Double-click Install Mysql-server,mysql-client and mysql-devel three installation packages.
2. Start MySQL
[[email protected] desktop] #service mysql start
Get error:error! The server quit without updating PID file
We are here mainly because:SELinux, if it is a CentOS system, the default is to turn on SELinux. The workaround is to close it, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine.
And then start MySQL again, there's no problem:
[[email protected] desktop] #service mysql start
To view MySQL running status:
[[Email protected] desktop]# service MySQL status
success! MySQL Running (2377)
3. Set the password
After installation, the root user does not have a password by default and the password is set by command.
[Email protected] desktop]#/usr/bin/mysqladmin-u root password ' passok '
Then set the root user's remote access permissions
Executing in MySQL console
GRANT all privileges on * * to ' root ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;
FLUSH privileges;
4. Turn on remote connections
Need to install iptables,
Yum install-y iptables
Then edit the system's open port list, add 3306 ports, and restart the firewall.
CentOS7 installing MySQL and turning on remote access