Centos mysql installation and configuration
Install Mysql
- 1
Installing Mysql under Centos 6.6 is very simple,
yum list mysql-server
- 2
When there is only one, it can be directly
yum install mysql-server
To install
- 3
Select Y to continue the installation during the process, and finally the installation is successful
END
Set up Mysql service##
- 1
Start the Mysql service first
service mysqld start
- 2
Connect it and try it directly
mysql
then
\ q
Close the connection
- 3
Set Mysql to start at boot
chkconfig mysqld on
- 4
Open 3306 port and save
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
END
Change password and set remote access##
- 1
Connect to mysql database
set password
use mysql;
update user set password=password('password') where user='root';
flush privileges;
- 2
Set up Mysql remote access
grant all privileges on . to 'root'@'%' identified by '123456' with grant option;
END
Solve the problem of Mysql garbled##
Find a configuration file, copy it to the /etc/ directory, and name it my.cnf
(Sometimes there is no my.cnf)
cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf
vim my.cnf
Add under [client] and [mysqld]
default-character-set=utf8
- 3
Finally press Esc to enter
: wq
Save and exit
END
Restart mysql service##
- 1
Finally, restart the service.
service mysqld restart
END
Precautions##
-
Finally, the service must be restarted
-
Now Centos cannot install Mysql directly, you can see Mariadb installation in my experience