Centos6.8 steps to install mysql

The first step, the next to see whether the CentOS install mysql

Enter the command: yum list installed | grep mysql

Step 2, to delete the installed mysql

Enter the command: yum -y remove mysql

Step 3 Check yum repository mysql (non-essential)

Enter the command: yum list | grep mysql

Step 4, the mounting yum library mysql

Enter the command: yum -y install mysql mysql-server mysql-devel

Step 5 to verify that the installation was successful

Enter the command: rpm -qi mysql-server

Step 6, start MySql service

Enter the command: service mysqld start

Step 7, enter MySql

Enter the command: mysql -u root

Step 8, change passwords

mysql > use mysql; 
mysql > update user set password=password(‘123456‘) where user=‘root‘;

Step 9, with the new password

mysql -u root -p

Step 10. Open remote login privileges

Enter the command: GRANT ALL PRIVILEGES ON * * TO 'root' @ '%' IDENTIFIED BY ' your password' the WITH GRANT OPTION; 
FLUSH PRIVILEGES;

Step 11, the open port 3306
enter the command: vim / etc / sysconfig / iptables 
added: -A INPUT -p tcp -m state -state 
then restart the firewall: service iptables restart

Step 12, set the boot (must)

chkconfig mysqld on

Transfer from CSDN to facilitate their access to home use

Guess you like

Origin www.cnblogs.com/gshelldon/p/11423715.html