linux 安装mysql 8.0(yum方式)
先卸载MariaDB
# 检查有没有 mariadb
rpm -qa | grep -i mariadb
# 卸载mariadb
rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
检查是否有mysql残留
# 检查mysql是否有残留
rpm -qa | grep mysql
# 有的话也卸载
rpm -e --nodeps xxxxx
下载mysql库
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
安装mysql库
yum -y install mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-libs-compat -y
重新获取mysql的GPG
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
安装mysql
yum -y install mysql-community-server
开启mysql服务
systemctl start mysqld
- 检查mysql运行状态
systemctl status mysqld
查看默认密码
cat /var/log/mysqld.log | grep password
修改密码&开启远程访问
[root@ybchen-1 mysql]#
[root@ybchen-1 mysql]# pwd
/var/lib/mysql
[root@ybchen-1 mysql]#
[root@ybchen-1 mysql]# cat /var/log/mysqld.log | grep password
2023-05-26T09:41:05.264719Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: PNkUvy2E.Pd.
[root@ybchen-1 mysql]#
[root@ybchen-1 mysql]#
[root@ybchen-1 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.33
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root1234.';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> update user set host = '%' where user = 'root';
ERROR 1046 (3D000): No database selected
mysql> update mysql.user set host = '%' where user = 'root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql>
注意:修改好mysql远程访问后,需要重新刷新权限:flush privileges;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
2020-05-26 input标签 只能输入纯数字
2020-05-26 使用bootstrap-select 动态加载数据不显示的问题,级联数据置为空
2019-05-26 动软代码生成器学习