mysql安装

2023-12-17

演示环境为Centos7:

1. 下载mysql-yum源:

wget  https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm

2. 安装mysql-yum源:

yum -y install  mysql80-community-release-el7-7.noarch.rpm

3. 安装mysql

yum clean all && yum makecache
yum -y  install mysql-community-server

4. 启动:

systemctl start mysqld
systemctl enable mysqld

5. 查看密码:

grep 'temporary password' /var/log/mysqld.log

6. 修改密码:

mysql -uroot -ppassword
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

7. 登录授权:

UPDATE user SET host='%' WHERE user = 'root';      #8.0以上使用
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'YIERSAN123pp@' WITH GRANT OPTION;   #5.7
FLUSH PRIVILEGES;

8. 安装其他版本:

yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
若执行命令提示:-bash: yum-config-manager: command not found
yum -y install yum-utils
通过修改/etc/yum.repos.d/mysql-community.repo文件选择版本
enabled=0  #禁用
enabled=1  #启用
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

mysql安装 的相关文章

随机推荐