CentOS7安装调试Mysql数据库
admin
2023-03-04 16:03:07
0
   本实例要求下载并安装调试Mysql数据库。

第一步:下载Mysql数据库安装所需的全部软件。

我已提前下载好数据库软件,直接在服务器下载即可,如下:
通过scp直接下载:
[root@agt20 ~]# scp root@192.168.122.10:/root/mysql* /root/

软件如下图:
[root@agt20 ~]# ls mysql-*
mysql-5.7.17.tar
mysql-community-client-5.7.17-1.el7.x86_64.rpm
mysql-community-common-5.7.17-1.el7.x86_64.rpm
mysql-community-devel-5.7.17-1.el7.x86_64.rpm
mysql-community-embedded-5.7.17-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm
mysql-community-libs-5.7.17-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm
mysql-community-server-5.7.17-1.el7.x86_64.rpm
mysql-community-test-5.7.17-1.el7.x86_64.rpm

第二步:通过yum进行安装,起服务器并查看

[root@agt20 ~]# yum -y install mysql-*.rpm
[root@agt20 ~]# systemctl restart mysqld
[root@agt20 ~]# systemctl enable mysqld
[root@agt20 ~]# systemctl status mysqld.service
\u25cf mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since \u4e8c 2019-10-15 11:29:11 CST; 1min 15s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 31584 (mysqld)
CGroup: /system.slice/mysqld.service
\u2514\u250031584 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid...

10\u6708 15 11:28:42 agt20.tedu.cn systemd[1]: Starting MySQL Server...
10\u6708 15 11:29:11 agt20.tedu.cn systemd[1]: Started MySQL Server.
[root@agt20 ~]#

第三步:连接MySQL服务器,修改密码;

1)查看初始密码
[root@agt20 ~]# grep -i 'password' /var/log/mysqld.log
2019-10-15T03:28:55.200931Z 1 [Note] A temporary password is generated for root@localhost: r3qhDysMrM)
2)使用初始密码连接mysql服务
[root@agt20 ~]# mysql -uroot -p'r3qhDysMrM
)'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

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>
3)重置数据库管理员roo本机登录密码
mysql> alter user root@localhost identified by 'Pwd@123...';
Query OK, 0 rows affected (0.00 sec)
4)修改密码策略
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.01 sec)
mysql> set global validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user root@localhost identified by 'pwd@123';
Query OK, 0 rows affected (0.00 sec)
5)使用修改后的密码登录
[root@agt20 ~]# mysql -uroot -ppwd@123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

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>

至此Mysql数据库安装调试完成!!!!
    。
    。
    。
    。
    。

相关内容

热门资讯

民调:包括共和党人在内,美国人... 据美国有线电视新闻网(CNN)当地时间24日报道,多项最新民调结果显示,包括许多共和党人在内,美国民...
一个人害得全县买不了榴莲,恶意... 作者:何涛 责编:任绍敏据央视报道,近日,湖南衡山县人民法院审结一起案件:当地一男子用AI伪造榴莲、...
“红霞”已加强为强台风,中央气... 今年第12号台风“红霞”已于今天晚上10时由台风级加强为强台风级,中央气象台发布今年首个台风红色预警...
携程为何被处51.79亿元重罚... 今天(25日),市场监管总局依法对携程集团有限公司滥用市场支配地位实施垄断行为作出行政处罚,罚没款合...
山西一学生在黄土崩塌中遇难:中... 据央视新闻:7月24日18时49分,山西省洪洞县好义村发生黄土崩塌,造成一户民宅被掩埋,造成5人死亡...
“日本已有半年看不到大熊猫了” 今年1月27日,双胞胎大熊猫“晓晓”和“蕾蕾”从日本返回中国。25日,日本共同社发文感慨:到本月27...
江苏:以应用带产业给力交通“智... 胥大伟 7月23日,江苏省政府举行“人工智能+交通运输”路演会。会上发布了《江苏省“人工智能+交通运...
中国AI成功救场后,OpenA... 近日,美国人工智能公司OpenAI的模型在安全测试中失控“越狱”,攻击了全球最大AI开源平台Hugg...
新华社出图|这就是“千年瓷都”... 在中国乃至世界版图上这座城市都是独一无二一捧泥一窑火一条路让这里被世界认识更令世界倾心“中国瓷”这就...
洗衣机放不掉水怎么修 当你的洗衣机不能放水时,你可能会感到很不方便。这可能是由于以下几种原因: 1. 水龙头未打开:检查...