Centos 安装 mysql

Centos安装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 install mysql-community-server -y
检查MySQL状态
service mysqld status
开启MySQL服务
service mysqld start 
重启MySQL服务
# service mysqld restart
设置为开机启动
# chkconfig --list | grep mysqld
# chkconfig mysqld on
设置MySQL密码,第一次登陆不需要密码回车进入;设置本机MySQL密码及远程登录密码:
# mysql; 
mysql> use mysql; mysql
> update user set password=password('你设置的密码') where user='root' and host='localhost'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你设置的密码' WITH GRANT OPTION; mysql> flush privileges; mysql> quit

 

 

 

参考自:https://www.cnblogs.com/diandianxinghen/p/12942327.html

posted @ 2020-05-26 13:44  岳帅超  阅读(196)  评论(0编辑  收藏  举报