centos 6 安装 mysql
-
检查服务器是否已安装
mysql:yum list installed|grep mysql -
下载
mysql服务端源:wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-5.7.39-1.el6.x86_64.rpm -
安装
mysql服务端:rpm -ivh mysql-community-server-5.7.39-1.el6.x86_64.rpm --nodeps --force提示需要安装客户端依赖等错误:
error: Failed dependencies: mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.39-1.el6.x86_64 mysql-community-common(x86-64) = 5.7.39-1.el6 is needed by mysql-community-server-5.7.39-1.el6.x86_64
需要加--nodeps --force -
启动mysql
service mysqld start -
下载
mysql客户端:wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-5.7.39-1.el6.x86_64.rpm -
安装
mysql客户端:rpm -ivh mysql-community-server-5.7.39-1.el6.x86_64.rpm -
查看初始密码
grep "password" /var/log/mysqld.log -
登录
mysql:mysql -uroot -p输入初始密码修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx';需重启生效
service mysqld restart -
设置可远程连接
use mysql; update user set host = '%' where user ='root'; flush privileges;