
官方教程:
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
Mysql官方程序包地址:
https://repo.mysql.com/yum/
下载rpm程序包
(不同的版本可以去上面的程序包的库里找)
1
| wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
|
安装程序包
1
| rpm -ivh mysql-community-release-el7-5.noarch.rpm
|
安装mysql
1
| yum -y install mysql mysql-server mysql-devel
|
启动服务
连接数据库
查看临时root密码
1
| cat /var/log/mysqld.log | grep 'temporary password'
|
初始化数据库root密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| alter user user() identified by "xxxxx";
use mysql
update user set password=password('root') where user='root';
update user set authentication_string=password('root') where user='root';
flush privileges;
quit;
|
至此安装完成!
卸载
停止服务
1
| systemctl stop mysqld.service
|
查看已安装软件
1
| yum list installed | grep mysql
|
卸载安装软件 根据上一步列出的安装软件进行卸载
1
| yum remove mysql-community-client mysql-community-common mysql-community-server mysql-community-libs mysql-community-libs-compat
|
查看残留文件
1 2 3 4 5
| whereis mysql #或 find / -name mysql
rm -rf xxx
|