centos6 yum安装mysql 5.6

一、首先检查系统是否SELINUX启用,关闭!!
再检查安装其他版本的MYSQL数据,有的话干掉老版本数据库
#yum list installed | grep mysql
mysql-libs.x86_64      5.1.73-5.el6_6   @anaconda-CentOS-201508042137.x86_64/6.7
#yum -y remove mysql-libs.x86_64
二.安装及配置
# 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
安装成功后在/etc/yum.repos.d/下会多出几个mysql的yum源的配置
下面安装MYSQL数据库,这个过程比较久
# yum install mysql-community-server -y

三。设置为开机启动(2、3、4都是on代表开机自动启动)
# chkconfig --list | grep mysqld
# chkconfig mysqld 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原本编码:
mysql> show variables like 'character%';
# vi /etc/my.cnf
[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