CentOS7安装调试Mysql数据库的步骤详解【实例】

 更新时间:2019年10月15日 15:02:47   作者:爱草坪  
这篇文章主要介绍了CentOS7安装调试Mysql数据库,本文分步骤通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下

本实例要求下载并安装调试Mysql数据库。

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

我已提前下载好数据库软件,直接在服务器下载即可,如下:

通过scp直接下载:

[root@agt20 ~]# scp [email protected]:/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)
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数据库安装调试完成!!!!

总结

以上所述是小编给大家介绍的CentOS7安装调试Mysql数据库的步骤详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对华域联盟网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

  • linux操作系统原理 linux系统基础教程

    linux操作系统原理 linux系统基础教程

    很多对linux操作系统有兴趣的朋友想有一个深入的学习,本篇文章给大家详细讲解了linux操作系统的原理,希望能够对你有所帮助。

    2018-01-01

  • 在Linux下用 mkdir 命令来创建目录和子目录的用法

    在Linux下用 mkdir 命令来创建目录和子目录的用法

    这篇文章主要介绍了在Linux下用 mkdir 命令来创建目录和子目录的用法,具体一定的参考价值,有需要的可以了解一下。

    2016-10-10

  • CentOS7安装配置 Redis的方法步骤

    CentOS7安装配置 Redis的方法步骤

    这篇文章主要介绍了CentOS7安装配置 Redis的方法步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    2019-04-04

  • CentOS 7 安装 MySQL 5.6遇到的各种问题小结

    CentOS 7 安装 MySQL 5.6遇到的各种问题小结

    在一测试服务器(CentOS Linux release 7.2.1511)上安装MySQL 5.6(5.6.19 MySQL Community Server)时遇到了很多奇葩问题,今天小编给大家总结了关于entOS 7 安装 MySQL 5.6遇到的各种问题,需要的朋友一起看看吧

    2016-11-11

  • PHP程序员玩转Linux系列 Linux和Windows安装nginx

    PHP程序员玩转Linux系列 Linux和Windows安装nginx

    这篇文章主要为大家详细介绍了PHP程序员玩转Linux系列文章,Linux和Windows安装nginx教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

    2017-04-04

  • Ubuntu安装和卸载CUDA和CUDNN的实现

    Ubuntu安装和卸载CUDA和CUDNN的实现

    这篇文章主要介绍了Ubuntu安装和卸载CUDA和CUDNN的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    2020-08-08

  • LNMP系列教程之 设置301重定向的方法

    LNMP系列教程之 设置301重定向的方法

    因为LNMP系统环境采用的是Nginx而不是Apache,所以在设置301重定向的时候,不是简单的在根目录.htaccess文件添加代码就可以实现,因为他需要对单独的网站conf文件进行修改配置

    2012-09-09

  • 详解在Linux下搭建Git服务器

    详解在Linux下搭建Git服务器

    本篇文章主要介绍了详解在Linux下搭建Git服务器,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    2017-04-04

  • 详解CentOS下Nginx如何禁止IP访问

    详解CentOS下Nginx如何禁止IP访问

    服务器的安全相信是每位运维人员最关心的问题,不知道大家在使用的时候会不会遇到很多的恶意IP攻击,最近公司的服务器就遇到了这个问题,这个时候就要用到Nginx 禁止IP访问了。本文介绍了详细的步骤,有同样问题的朋友们可以参考学习。

    2016-10-10

  • tmpwatch命令清除旧文件的方法

    tmpwatch命令清除旧文件的方法

    这篇文章主要介绍了tmpwatch命令清除旧文件的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

    2020-10-10

最新评论

声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。