一、检查系统是否安装其他版本的MysqL数据
二、安装及配置
# wget http://repo.MysqL.com/MysqL-community-release-el6-5.noarch.rpm
# rpm -ivh MysqL-community-release-el6-5.noarch.rpm
# yum repolist all | grep MysqL
安装MysqL数据库
设置为开机启动(2、3、4都是on代表开机自动启动)
三、设置远程root
启动MysqL
# service MysqLd start
设置root密码
# MysqL_secure_installation
登陆root账号
# MysqL -uroot -p
建立远程root用户
MysqL> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION;
MysqL> flush privileges;
四、设置utf-8编码
查看MysqL原本编码:
设置编码
# vi /etc/my.cnf
如下(少补):
[MysqLd]
character-set-server=utf8
collation-server=utf8_general_ci
[MysqL]
default-character-set = utf8
[MysqL.server]
default-character-set = utf8
[MysqLd_safe]
default-character-set = utf8
[client]
default-character-set = utf8
重启MysqL
# service MysqLd restart
再次查看编码:
# MysqL -uroot -p
MysqL> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/MysqL/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
允许所有外部链接访问(可选)
MysqL -u root -p
MySQL命令行输入
GRANT ALL PRIVILEGES ON *.* TO 'root'@%' IDENTIFIED BY 123456' WITH GRANT OPTION; FLUSH PRIVILEGES;
参考:http://blog.csdn.net/pengzhenjie36/article/details/75053059(Centos6.8通过yum安装mysql5.7)