JDBC usage exercise in Java-error MySQL access denied for user ODBC @ localhost

Source: Internet
Author: User

1.

After installing and setting MySQL, run CMD in windows and run the MySQL Command. An error occurs:

Cause:

In Windows, the default DoS user is ODBC, but there is no ODBC user in MySQL, so an error occurs. You can change it to MySQL-uroot-P. Here the root user is used, you can also use other users, provided that they have local logon permissions.

My solution:

Run the command-mysql-H localhost-u root-P

Enter the password of the root account.

2. Use in crazy Java

Mysql-P password-u user name-H Host Name

No database is created on the machine, so the password after-P does not need to be entered; otherwise, an error is reported.



Run:

Mysql-p-u root-H localhost

Enter the password again.


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.