Ubuntu16 Install mysql5.7 not prompt for password, after installation, modify the MySQL password default password

Source: Internet
Author: User

Ubuntu16 Install mysql5.7 not prompt for password, after installation, modify the MySQL password default password

MySQL default password is empty

But when you use the MYSQL-UROOT-P command to connect to MySQL, an error

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost '

At this point, you can change the root default password

--------------------------------------------------------------------------------------------------------------- ---------------------------

1. Go to the Etc/mysql directory and view the debian.cnf file

2. Locate your username, password, and log in to MySQL using this account.

User name: Debian-sys-maint

Password: XEDVSNKDLAVJUEWV

Login: MYSQL-UDEBIAN-SYS-MAINT-PXEDVSNKDLAVJUEWV

3. Change the password of the root user

Here is the key point, because mysql5.7 does not have a password field, the password is stored in the Authentication_string field, and the password () method can also be used

Execute the following statement in MySQL to modify the password

 

4. After changing the password, you need to restart MySQL

/etc/init.d/mysql restart;

Sign in again
Mysql-u root-p password;

It's OK.

--------------------------------------------------------------------------------------------------------------- ---------------------------

I uninstalled many times MySQL, reinstall or do not prompt to enter the password, this method solves the problem

Attach the steps to uninstall and install MySQL.

Unloading:

sudo apt purge mysql-*sudo rm-rf/etc/mysql//var/lib/mysqlsudo apt autoremove

Installation:

# when the installation will prompt to set the root password, if you do not uninstall the time to clean up the residual data is not prompted to set the root password, I do not prompt, you can use the method above to modify the password sudo apt-get install mysql-client Mysql-server #检查mysql是不是在运行sudo service MySQL status# General installation will automatically run after the completion, if not run can startsudo service MySQL start

  

Ubuntu16 Install mysql5.7 not prompt for password, after installation, modify the MySQL password default password

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.