First, after sudoapt-getinstallmysql-servermysql-client is installed, the mysql service starts to run. in this case, you need to change the root password, but this often happens when 'accesssdeniedforuser' root' @ 'localhost' (usingpassword: YES) 'or other situations that cause the user to log on to mysql. To solve this problem, follow these steps: 1. Open/et first: sudo apt-get install mysql-server mysql-client
After the installation is complete, the mysql service starts to run. You need to change the root password, but this situation often occurs.
'Access denied for user' root' @ 'localhost' (using password: YES) 'or other situations that cause logon Failure to mysql. Here we can solve the problem by following the steps below:
1. Open the/etc/mysql/debian. cnf file and store the related password.
Sudo gedit/etc/mysql/debian. cnf
In the [client] segment, there are user = and password =. This is what we need.
2. Enter the command: mysql-udebian-sys-maint-p
Debian-sys-maint is debian. content following user = in cnf. after you press enter, you will be prompted to enter the password. copy and paste the content after password =, and press enter to start the mysql console. (generally, do not press the password. It is easy to make mistakes. Copy the password)
3. After Entering the console, follow these steps:
Use mysql;
Update user set password = PASSWORD ('new password') where user = 'root ';
Flush privileges;
In this case, you can enter quit; log out with the root account, or continue other operations
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.