The third Ubuntu, MySQL root user password forgot what to do?

Source: Internet
Author: User

For a long time not using Ubuntu, come in to play today, the result even the root user password of the MySQL forgot. On the internet to find a bit, found the following solutions, try a bit, feasible! It is important to note that environmental issues are recorded here.

Ubuntu Server 12.04 LTS, with Apt-get installation of the MySQL process is not prompted to set the root account password, after the installation of the discovery root empty password can not log in.

Solution:

In fact, the Debian Department of the MySQL installation process will be set up a default account, this file has saved the default account information

cat /etc/mysql/debian.cnf

Note: The password here is clear text!

Then we can use this account to log in to MySQL

mysql -udebian-default-account -pdefaultpassword

This account has permission to operate the MySQL database, so we can change the root password

use mysqlset password for ‘root‘@‘localhost‘ = password(‘yourpass‘);
OK!

再次使用新设的root密码可以进行登陆了!

The third Ubuntu, MySQL root user password forgot what to do?

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.