Tutorial for installing and configuring MySql 5.7 under Alibaba Cloud ECS centos 6.8

  • 2021-08-28 21:25:19
  • OfStack

Alibaba Cloud default MySQL under the yum command is 5.17****. Before installing mysql 5.7, uninstall the previous version, including cleaning the previous database-check the/var/lib/mysql, and clean it if there is a historical file backup.

1. Find the appropriate rpm download from https://dev.mysql.com/downloads/repo/yum/

2. After downloading, execute the command " yum localinstall mysql-community-release-el6-5.noarch.rpm ";

3. After completion, execute the command. " yum install mysql-community-server ", waiting for the installation to be completed;

4. Orders " service mysqld start ", if the startup failure may be caused by the existence of version history, find/var/lib/mysql to clear the data in it;

5. After startup, the database will be initialized first, and an root temporary login password will be generated (all previous versions were empty passwords). The temporary password adopts the command " grep "temporary password" /var/log/mysqld.log” View

This allows you to log in to the system using the temporary password mysql -u root -p dZut3)i&nUi< ;

6. After logging in, the authority is limited. You must change the password first, otherwise the following prompt will appear

By default, mysql5.7 requires password length and complexity. If it is only used for test development, it is completely unnecessary to set a '123456' password. You can use the command " SHOW GLOBAL VARIABLES LIKE 'validate% '; "View the current password setting related parameters, if simple to use, can be added in the configuration file/etc/my. cnf" validate_password=off ", close" validate_password ".

7. Restart " service mysqld restart "You can log in with password 123456.


Related articles: