[root@iZ4qq76j5p04zsZ ~]# yum repolist all | grep mysql mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community disabled mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community disabled mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled mysql-connectors-community/x86_64 MySQL Connectors Community enabled: 128 mysql-connectors-community-source MySQL Connectors Community - disabled mysql-tools-community/x86_64 MySQL Tools Community enabled: 100 mysql-tools-community-source MySQL Tools Community - Sourc disabled mysql-tools-preview/x86_64 MySQL Tools Preview disabled mysql-tools-preview-source MySQL Tools Preview - Source disabled mysql55-community/x86_64 MySQL 5.5 Community Server disabled mysql55-community-source MySQL 5.5 Community Server - disabled mysql56-community/x86_64 MySQL 5.6 Community Server disabled mysql56-community-source MySQL 5.6 Community Server - disabled mysql57-community/x86_64 MySQL 5.7 Community Server enabled: 384 mysql57-community-source MySQL 5.7 Community Server - disabled mysql80-community/x86_64 MySQL 8.0 Community Server disabled mysql80-community-source MySQL 8.0 Community Server - disabled
[root@iZ4qq76j5p04zsZ ~]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2019-10-23 15:54:10 CST; 1min 23s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 11649 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 11600 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 11652 (mysqld) CGroup: /system.slice/mysqld.service └─11652 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Oct 23 15:54:04 iZ4qq76j5p04zsZ systemd[1]: Starting MySQL Server... Oct 23 15:54:10 iZ4qq76j5p04zsZ systemd[1]: Started MySQL Server. [root@iZ4qq76j5p04zsZ ~]#
这里【 Active: active (running) since Wed 2019-10-23 15:54:10 CST; 1min 23s ago】告诉你mysql已经在哎运行
如图所示,是已经启动了
8.寻找登录密码
mysql 5.7的新特性之一就是在初始化的时候会生成一个自定义的密码,然后咱们需要找到这个密码,登录的时候需要输入。
[root@iZ4qq76j5p04zsZ ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.28
Copyright (c) 2000, 2019, 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>
10.修改数据库密码
注意,修改的密码不能简单。需要包含把大小写字母和数字。然后切记切记,mysql里面的命令要加分号!分号!分号!
SET PASSWORD = PASSWORD(‘Admin123!’);【括号里的字符就是你要设置的密码】