What
mysql是 传统关系型数据库
Why
centos 一般自带的都是比较老的版本 ,需要新版版
How
- 查看并删除老版本
yum list installed | grep mysql
yum -y remove mysql-libs.x86_64
- 下载yum源文件并安装
https://dev.mysql.com/downloads/repo/yum/
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
-
查看一下是否已经有mysql可安装文件
yum repolist all | grep mysql
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community
-
安装mysql 服务器命令
yum install mysql-community-server
-
启动服务
service mysqld start
-
进入mysql
mysql -u root
1
2
3
4use mysql;
update user set password=123456 where User='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
注意点
跳过权限
mysqld_safe --skip-grant-tables
use mysql;
UPDATE user SET Password=PASSWORD('123456') where USER='root';
FLUSH PRIVILEGES;