The root User Name in ubuntu cannot enter mysql, how to view the user name and password, how to modify the root password, and tumysql

Source: Internet
Author: User

The root User Name in ubuntu cannot enter mysql, how to view the user name and password, how to modify the root password, and tumysql
Mysql-u root-p Press enter. after entering the password, the system prompts "access denied... ues password YES/NO" error.

Step 1:

In this case, you need to enter the/etc/mysql directory, and then sudo vim/vi debian. cnf view the username and password in the file, and then use the username and password in the file to enter mysql. If debian. if the user name in cnf is debian-sys-maint, then:

Mysql-u debian-sys-maint-p press Enter. In this case, you need to enter the password and copy the password in debian. cnf (do not enter it manually because it is prone to errors ).

Now you can access mysql.


Step 2:

Change root Password

Log on to the mysql client according to the previous step.
Mysql> use mysql;
Database changed
Mysql> update user set password = password ('new password') where user = 'root ';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> quit


Step 3:

Use the newly changed root and password to log on and view.




Why can't I use the default account and password root when I log on to mysql?

1. Check whether your mysql instance works properly.
Log on to the database
Cmd -- input in the "command prompt character" window,
Enter cd C: \ mysql \ bin and press the Enter key to switch the directory to cd C: \ mysql \ bin
Enter the mysql-uroot-p command and press enter to prompt you to enter the password. If you have just installed MYSQL, the Super User root has no password, so press enter to enter MYSQL.
MYSQL prompt: mysql>
2. Check whether the show databases is returned.
If an error occurs, the mysql installation may be incorrect.
Reconfiguration

In c: \ windows \ my. ini
Look
User = root
Password =
These two items.

(3) change the MySQL database directory
A) Open the cmd Command Prompt window, enter the command: net stop mysql to stop MySQL service running; B) Open X: \ Server_Core \ MySQL \ my. ini,
Find:
Datadir = "X: \ Server_Core \ MySQL \ data"
To:
Datadir = "X: \ Database"
C) copy the X: \ Server_Core \ MySQL \ data folder to X: \ and rename it to X: \ Database;
D) Open the cmd Command Prompt window and enter the command: net start mysql to start the MySQL service.
E) re-test whether MySQL works normally.

(4) Prepare LibMySQL Dynamic Link Library
Convert the X: \ Server_Core \ MySQL \ bin \ libmySQL. dll file
Copy to C: \ Windows \ System32.

If not, reinstall it. It is best to use the installation version of mysql.
Recommended version 4.1.22

Why can't I use the default account and password root when I log on to mysql?

MYSQL prompt: mysqlamp; gt; 2. display the database nbsp; use this nbsp; shownbsp; databases; nbsp; to check whether the returned value exists. If an error occurs, the mysql installation may be incorrect. Reconfigure in c: windowsmy. ini to see user = rootpassword = nbsp. (3) nbsp; change MySQL database directory a) nbsp; open the cmd Command Prompt window, enter the command: netnbsp; stopnbsp; mysqlnbsp; stop MySQL service running; B) nbsp; open X: server_CoreMySQLmy.ini, locate: Datadirnbsp; = nbsp; "X: Server_CoreMySQLdata" and change it to Datadirnbsp; = nbsp; "X: Database" c) nbsp; Convert X: Server_CoreMySQLdatanbsp; copy the folder to X: and rename it to X: Database; d) nbsp; open the cmd Command Prompt window and enter the command netnbsp; startnbsp; mysqlnbsp; to start the MySQL service. E) nbsp; re-test whether MySQL works normally. (4) Prepare the LibMySQL dynamic link library to copy the X: Server_CoreMySQLinlibmySQL.dllnbsp; file to nbsp; C: WindowsSystem32. If not, reinstall it.

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.