查看系统是否存在mysql,如果存在则删除
yum list installed | grep mysql
如果存在则执行下面的命令
yum -y remove mysql-libs.x86_64
当然,如果查出来的是哪个就删除哪个
然后下载mysql源,当然你可以也可以选择比较新的源,这个目前是mysql5.6
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
接下来安装源
rpm -ivh mysql-community-release-el6-5.noarch.rpm
看看是不是已经安装成功
yum repolist | grep mysql
<p>yum list installed | grep mysql</p>
接下来安装mysql
yum -y install mysql-community-server
注意:
在启动前,建议先配置下/etc/my.conf,在[mysqld]修改和加入
character-set-server=utf8mb4
datadir=/home/mysqldata
socket=/home/mysqldata/mysql.sock
在[client]下加入(如果没有client,需要自行创建)
socket=/home/mysqldata/mysql.sock
然后
service mysqld start
接下来修改密码,注意默认密码是空
mysql -u root -p
use mysql;
update user set password=password('123456') where user='root';
flush privileges;
修改成远程可登陆
GRANT ALL PRIVILEGES ON TO 'root'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION;
flush privileges;
完毕!