How to troubleshoot a MySQL installation without knowing the initial password

Source: Internet
Author: User

Recently, because of the need to use MySQL, and then according to the old boy's "with the old boy Learning Linux operation--web Cluster practice" to build some problems in MySQL, in the initial study, It is recommended that you complete the installation step by step in accordance with the content (after all, the initial time you do not know what the meaning of writing), the result of a problem I struggled for a long time-the initial login to the MySQL suddenly found that I did not want to enter the password, but for no password ah, And then the use of all the passwords are entered once (after all, this server did not do anything, all kinds of login passwords are the same) the results found that the landing is not. Finally in the online various Baidu, finally found: the original in mysql5.5 (or 5.7) after the default password is no longer empty, but there will be a randomly generated initial password. The password is in the following path/var/log/mysqld.log (remember not to use /root/. MySQL _secret, no use. )。 by grep Password-n/var/log/mysqld.log found something similar to the following:9:2017-05-18t06:40:17.259575z 1 [Note] A temporary password is generated for [email protected]:lu=UN2RGEGBC This time using this login is OK, and then set their own password.

Change Password: First modify the rules of the password. The default is three levels of 0, 1, 2. Level 0 Card length, 1 card length, and character condition. So for the password is not set so complex, the Change password rule is 0. (default is 1).  

set global validate_password_policy=0;  

set Password: set Password=password (' redhat123 ');  

so you can log in. Show databases can see if it is successful. This time, the password to remember.

how to remotely log in to the MySQL database via the ip+ port number?  

First log in to the database at the shell terminal and execute the following statement grant all privileges on * * to ' itoffice ' @ '% ' identified by ' Itoffice ' with GRANT OPTION; flush privileges takes effect. This time can be directly used in the form of ip+ port number login.



This article is from the "Let the past like Smoke" blog, please be sure to keep this source http://kalson.blog.51cto.com/12267030/1953966

How to troubleshoot a MySQL installation without knowing the initial password

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.