标签:lis 添加 note list 修改密码 serve 文件 local arc
1.执行 rpm -qa|grep mariadb 查看是否有mariadb的安装包
有则执行 例如 rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64 删除上面语句查出来的包
rpm -qa | grep mysql 查看是否有mysql 的安装包
有则删除安装包
2. https://dev.mysql.com/downloads/repo/yum/ 在MySQL官网下载5.7
复制链接
进行安装
cd /usr/local/src/
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
查看yum源中的mysql安装包
yum repolist all | grep mysql
上面的命令可以看到yum源中默认启用的安装包版本为MySQL8.0,如果需要切换为5.7,需要运行以下命令;
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum repolist all | grep mysql
yum -y install mysql-community-server --执行太慢失败
由于yum下载太慢 参考https://www.cnblogs.com/zk1023/p/12303775.html 还是不行 --执行太慢失败
所以用离线方式下载
yum 下载的缓存文件路径在 :
[root@zsls src]# cd /var/cache/yum/x86_64/7/mysql57-community/packages/
[root@zsls packages]# ls
mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm
mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm
国内镜像站:
http://uni.mirrors.163.com/mysql/Downloads/
http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/
从上面国内镜像下载对应的rpm文件 在通过sftp上传到服务器
然后在执行 yum -y install mysql-community-server
启动mysql服务
systemctl start mysqld.service
查看mysql服务运行状态
systemctl status mysqld.service
[root@zsls packages]# systemctl start mysqld.service
[root@zsls packages]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-02-13 17:34:38 CST; 3min 48s ago
获取安装时临时密码
[root@zsls packages]# grep ‘temporary password‘ /var/log/mysqld.log
2020-02-13T09:34:34.619238Z 1 [Note] A temporary password is generated for root@localhost: aAbffS1(5)o;
通过使用生成的临时密码登录并为超级用户帐户设置自定义密码,尽快更改root密码
[root@zsls packages]# mysql -uroot -p
Enter password:
输入以上临时密码
修改密码
alter user ‘root@localhost‘ identified by ‘zsls@123‘;
如果您需要修改简单密码,可以依次执行以下操作步骤:
set global validate_password_policy=0;
set global validate_password_length=1;
set global validate_password_mixed_case_count=2;
alter user ‘root‘@‘localhost‘ identified by ‘123456‘;
授权其他机器可以登录
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
配置默认编码为utf8:
vi /etc/my.cnf
#添加
[mysqld]
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
其他默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
标签:lis 添加 note list 修改密码 serve 文件 local arc
原文地址:https://www.cnblogs.com/zk1023/p/12304365.html