Installing MySQL5.7.20 with Yum under CentOS 7.4 is the simplest

Source: Internet
Author: User
Tags alphanumeric characters

CentOS7 default database is mariadb, but a lot of the use of MySQL, but the CentOS7 yum source default seems to be no MySQL.

The previous installation was 5.6 but I would like to install 5.7 Yum install is the simplest to try to compile and install various problems, and finally decided to use Yum.

1. Uninstall first stop the MySQL process has not been installed can skip directly

Pkill-9 mysqld

Rpm-qa|grep-i MySQL

Yum-y Remove with command

Yum-y Remove mysql-community-client-5.6.38-2.el7.x86_64

Uninstall the Rpm-ev with no drop

Unload until No

2. Download MySQL repo source This installation mysql5.7.20/** correct it, this source is the latest version of the download ****/

[Email protected] ~]# cd/usr/local/src/
[Email protected] src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

[Email protected] src]# RPM-IVH mysql57-community-release-el7-8.noarch.rpm

[Email protected] src]# yum-y install Mysql-server

(You can also specify the installation directory Yum--installroot=/usr/local/mysql--releasever=/-y install mysql-server) I did not try to install the environment variable configuration is not your tube, installed on the direct start on the line. The installation path is the default.

All the way Y

Follow the steps to install it,

Default configuration file path:
Configuration file:/etc/my.cnf
Log file:/var/log/var/log/mysqld.log
Service startup script:/usr/lib/systemd/system/mysqld.service
Socket file:/var/run/mysqld/mysqld.pid

Configuring MY.CNF VIM/ETC/MY.CNF

  1. [Mysqld]
  2. #
  3. # Remove Leading # and set to the amount of RAM for the most Important data
  4. # Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%.
  5. # innodb_buffer_pool_size = 128M
  6. #
  7. # Remove Leading # to turn on a very important data integrity option: logging
  8. # changes to the binary log between backups.
  9. # Log_bin
  10. #
  11. # Remove Leading # to set options mainly useful for reporting servers.
  12. # The server defaults is faster for transactions and fast selects.
  13. # Adjust sizes as needed, experiment to find the optimal values.
  14. # join_buffer_size = 128M
  15. # sort_buffer_size = 2M
  16. # read_rnd_buffer_size = 2M
  17. datadir=/Var/lib/mysql
  18. socket=/Var/lib/mysql/mysql.sock
  19. server_id = 1
  20. Expire_logs_days = 3
  21. # Disabling Symbolic-links is recommended to Prevent assorted security risks
  22. symbolic-links=0
  23. log-error=/var/log/mysqld.log
  24. pid-file=/var/run/mysqld/mysqld.pid

However, after the installation is complete, the password is a random password and requires a password reset.

4. Start the MySQL service

Service mysqld Restart

Reset Password

[[email protected] ~]# grep "Password"/var/log/mysqld.log

You can see the input mysql-u root-p password into the first login, you need to reset the password or nothing can be manipulated

Next Reset Password: 5.7.20 for security password must contain alphanumeric characters

Stepped on the hole, Ah, set up several times. And this IP can not be% do not know why the first time set to% did not successfully boarded to change can be changed.

A simple way to change the password http://blog.csdn.net/z13615480737/article/details/78907697

Alter user ' root ' @ ' localhost ' identified by ' root!! 2018 ';

Finally, remember to refresh the permissions;

Flush Privileges

You can also add new users directly

CREATE USER ' root ' @ '% ' identified by ' your password ';

Grant all on * * to ' root001 ' @ ' percent ' identified by ' [E-mail protected]@ ' with GRANT option;

Add root user specified can be arbitrary IP login, if you want to limit only allow the specified IP login please replace% to IP address

Problem: If you find a password not found!!!!!

FIX: You can only change your password by forgetting your password!!! The password was not found during the installation process??? Toss a good long time by changing the password back to find, the original installed before the database in, there is no production of new database!! The previous configuration is used.

2. See if MySQL is up yet?  Did you initialize the database? General directly start the database can use grep "password"/var/log/mysqld.log see random password

To modify the login settings for MySQL: #vi/etc/my.cnf in the paragraph in [mysqld]: Skip-grant-tables Save and Exit VI. Restart Mysqld
Restart Mysqld
#/etc/init.d/mysqld Restart (Service mysqld restart)
Use MySQL
Update user set Password=password ("12345") where user= "root";
MySQL 5.7 database does not have a password field with the Authentication_string field
mysql> Update Mysql.user Set Authentication_string=password (' root ') where user= ' root ';
Flush privileges;
Change the password after changing it back

Installing MySQL5.7.20 with Yum under CentOS 7.4 is the simplest

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.