When I was just using MySQL, I encountered the following problems:
C: \ Program Files \ mysql \ MySQL Server 5.0 \ bin> MySQL
Error 1045 (28000): Access denied for user 'odbc '@ 'localhost' (using password: N
O)
Windows:
The main reason is that the pathenvironment variable of mysqlis not configured. Because mysql.exe is placed in the MySQL/lib directory, it cannot be found if it is not set.
Solution: Go to the lib directory of the MySQL Installation File.
C: \ Program Files \ mysql \ MySQL Server 5.0 \ bin> mysql-u root-P
Enter Password :******
Welcome to the MySQL monitor. commands end with; or \ G.
Your MySQL connection ID is 28 to server version: 5.0.24a-Community-NT
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Or: Put the MySQL/lib path in the path so that the system can find it.
Desktop> my computer> Properties> environment variables> New>
Path = "; path \ mysql \ bin;", where path is the installation path of MySQL.
The result is as follows:
C: \ Program Files \ mysql \ MySQL Server 5.0 \ bin> MySQL
Mysql> Status
Normal use ....
--------------------------------------------------
In Linux Ubuntu:
Method 1:
#/Etc/init. d/MySQL stop
# Mysqld_safe -- user = MySQL -- skip-grant-tables -- skip-Networking &
# Mysql-u root MySQL
Mysql> Update user SET Password = PASSWORD ('newpassword') where user = 'root ';
Mysql> flush privileges;
Mysql> quit
#/Etc/init. d/MySQL restart
# Mysql-uroot-P
Enter Password: <enter the new password newpassword>
Mysql>
Method 2:
Directly use the username and password provided in the [client] section of the/etc/MySQL/Debian. CNF file:
# Mysql-udebian-sys-Maint-P
Enter Password: <enter the password in the [client] section>
Mysql> Update user SET Password = PASSWORD ('newpassword') where user = 'root ';
Mysql> flush privileges;
Mysql> quit
# Mysql-uroot-P
Enter Password: <enter the new password newpassword>
Mysql>
Method 3:
I have not tested this method, because the default password of my root user has been modified by me. If you have time to test it, let me know the result. Thank you !!
# Mysql-uroot-P
Enter Password: <enter the password provided in [client] in the/etc/MySQL/Debian. CNF File>
At this point, many problems have been solved!