centos安装mysql57
Posted @SkySea
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos安装mysql57相关的知识,希望对你有一定的参考价值。
下载源安装文件
https://dev.mysql.com/downloads/repo/yum/
wget http://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
本地安装rpm包(配置MySQL安装源)
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
查看所有MySQL安装源(默认MySQL安装版本5.7)
yum repolist all | grep mysql
[root@bogon ~]# yum repolist all | grep mysql mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community 禁用 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - Sou 禁用 mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community 禁用 mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - Sou 禁用 mysql-connectors-community/x86_64 MySQL Connectors Community 启用: 36 mysql-connectors-community-source MySQL Connectors Community - Sour 禁用 mysql-tools-community/x86_64 MySQL Tools Community 启用: 47 mysql-tools-community-source MySQL Tools Community - Source 禁用 mysql-tools-preview/x86_64 MySQL Tools Preview 禁用 mysql-tools-preview-source MySQL Tools Preview - Source 禁用 mysql55-community/x86_64 MySQL 5.5 Community Server 禁用 mysql55-community-source MySQL 5.5 Community Server - Sour 禁用 mysql56-community/x86_64 MySQL 5.6 Community Server 禁用 mysql56-community-source MySQL 5.6 Community Server - Sour 禁用 mysql57-community/x86_64 MySQL 5.7 Community Server 启用: 187 mysql57-community-source MySQL 5.7 Community Server - Sour 禁用 mysql80-community/x86_64 MySQL 8.0 Community Server 禁用 mysql80-community-source MySQL 8.0 Community Server - Sour 禁用
yum -y install mysql-tools-community mysql-connectors-community mysql-tools-community
关闭MySQL 5.6安装源
sudo yum-config-manager --disable mysql56-community
开启MySQL 5.7安装源
sudo yum-config-manager --enable mysql57-community
没有yum-config-manager命令可以安装yum install yum-utils.noarch工具 或者编辑/etc/yum.repos.d/mysql-community.repo文件enable项为1表示开启,为0表示关闭
VI命令修改python版本为2.7
vi /usr/libexec/urlgrabber-ext-down
yum -y install yum-utils
vi /bin/yum-config-manager
安装MySQL
yum -y install mysql-devel mysql-community-server
启动MySQL
systemctl start mysqld.service
安全配置MySQL
mysql_secure_installation
查看root用户初始密码:
[root@bogon ~]# cat /var/log/mysqld.log | grep \'password\'
2017-05-16T02:49:27.631334Z 1 [Note] A temporary password is generated for root@localhost: ExQqWoo6Q1.u
mysql -uroot -p
设置密码
use mysql;
update user set password=password(\'密码\') where user=\'root\';
flush privileges;
一个错误:
mac mysql error You must reset your password using ALTER USER statement before executing this statement.
安装完mysql 之后,登陆以后,不管运行任何命令,总是提示这个
step 1: SET PASSWORD = PASSWORD(\'your new password\');
step 2: ALTER USER \'root\'@\'localhost\' PASSWORD EXPIRE NEVER;
step 3: flush privileges;
完成以上三步退出再登,使用新设置的密码就行了,以上除了红色的自己修改成新密码外,其他原样输入即可
远程连接设置
把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。
mysql> grant all privileges on *.* to root@\'%\'identified by \'password\';
如果是新用户而不是root,则要先新建用户
mysql>create user \'username\'@\'%\' identified by \'password\';
重启MYSQL
systemctl restart mysqld.service
此时就可以进行远程连接了。
以上是关于centos安装mysql57的主要内容,如果未能解决你的问题,请参考以下文章