Get the App
SLTechnology News&Howtos  ›  Database  › 

Example of centos7.3 installing mysql5.7.18

Shulou Source: shulou.com Published: 2022-06-01 00:02:22 09月15日 Update

4 start the database:

[root@typecodes ~] # systemctl start mysqld.service

Then use the command systemctl status mysqld.service to view the service status after the MySQL database is started:

5 get the initial password

After you install and start the MySQL service using YUM, the MySQL process automatically prints the initial password of the root user in the process log:

# obtain the initial password of the root user from the mysql process log: ra% yk7urCBIh [root @ typecodes ~] # grep "password" / var/log/mysqld.log2016-02-03T10:42:17.272166Z 1 [Note] A temporary password is generated for root@localhost: ra%yk7urCBIh2016-02-03T10:42:36.776875Z 2 [Note] Access denied for user 'password (using password: NO) 2016-02-03T10:42:52.063138Z 3 [ Note] Access denied for user 'root'@'localhost' (using password: NO) 2016-02-03T10:42:57.564373Z 4 [Note] Access denied for user 'root'@'localhost' (using password: NO) 2016-02-03T10:43:01.477007Z 5 [Note] Access denied for user 'root'@'localhost' (using password: NO) 2016-02-03T10:46:03.642008Z 6 [Note] Access denied for user' root'@'localhost' (using password: NO) 2016 -02-03T10:46:11.217889Z 7 [Note] Access denied for user 'root'@'localhost' (using password: NO) 2016-02-03T10:47:44.755199Z 0 [Note] Shutting down plugin 'validate_password'2016-02-03T10:47:46.505844Z 0 [Note] Shutting down plugin' sha256_password'2016-02-03T10:47:46.505851Z 0 [Note] Shutting down plugin 'mysql_native_password'

6 modify root user password

Use the initial password of the root user obtained in section 5, and then modify it:

Set global validate_password_policy = 0 MEDIUM / default is 1, so the password you just set must match the length and must contain numbers, lowercase or uppercase letters, and special characters.

Set global validate_password_length=4;// specifies the length of the data in the password alter user root@localhost identified by 'crow';// modifies the password

Increase remote access

GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' crow' WITH GRANT OPTION;FLUSH PRIVILEGES

Exit mysql and restart the service

Systemctl restart mysqld

Firewall opens port 3306

Firewall-cmd-zone=public-add-port=3306/tcp-permanent

Restart the firewall

Firewall-cmd-- reload [root@typecodes ~] # mysql-uroot-pEnter password: # enter the default root password and enter Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.7.10Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' new password';Query OK, 0 rows affected (0.00 sec) mysql > exitBye

7 installation completed

At this point, using the YUM method in CentOS7 to install the MySQL5.7.10 database is complete. As shown below, you can log in to MySQL with the new root password.

[root@typecodes] # mysql-uroot-ppasswordmysql: [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 3Server version: 5.7.10 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mysql > use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changedmysql > show databases +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ 4 rows in set (0.00 sec) mysql > clearmysql > exitBye [root@typecodes ~] # clear

Appendix 1: view configuration information for the MySQL database

The configuration file for MySQL is still / etc/my.cnf, and other installation information can be viewed through the mysql_config command. Where the dynamic library files are stored in the / usr/lib64/mysql directory.

Appendix 2: for developers such as CumberCraft +

Since you need to use header files such as mysql.h, you need to execute the following command to install the mysql development version.

[root@typecodes ~] # yum-y install mysql-community-devel

Appendix 3: delete Repository for MySQL

Because the Yum Repository for MySQL is installed in section 3, you will check for updates every time you perform a yum operation later. If you want to get rid of this automatic check operation, you can uninstall MySQL's Repository using the following command.

[root@typecodes ~] # yum-y remove mysql57-community-release-el7-7.noarchupdate 11:10 on April 10, 2017.10

Using the yum method above, you can also install the latest version of mysql5.7.18 on the official website of mysql. Just replace the version of the RMP package in section 2, and the subsequent steps remain the same.

Wget-I-c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm finished reading this article, I believe you have some understanding of "centos7.3 installation mysql5.7.18 example", if you want to know more about it, welcome to follow the industry information channel, thank you for reading!

Tags: Password data version database command user service section process appendix check example information official file method log article length firewall Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia vpn OPPO Reno MySQL