According to Crazy Java handout 13.3 of the program, found that the program run error.
1. Click Open Runconnmysql.cmd to run the file, the following results appear:
2. Compile and run with EditPlus, with the following results:
Error location to the 18th line of the program, and line 18th is the driver
Cause: Running the program requires MySQL database driver, the driver jar file is the E:\mysql-connector-java-5.1.30-bin.jar file, so you need to add the file to the environment variable CLASSPATH.
3. My Computer--right-click, properties--environment variables, add CLASSPATH environment variables:.; E:\mysql-connector-java-5.1.30-bin.jar(Note: Be sure to have a.; it means to include the current path)
4. Run with EditPlus again at this time
The program error points to 23 lines:
the description is a root permission issue. The reason is that root password is wrong, the password is not the program "32147", and it is my own password set.
4. Change the password of the program to my own password, then run it with EditPlus
Run the Runconnmysql.cmd file with the following results:
Summary: There are two errors: 1. mysql database driver E:\mysql-connector-java-5.1.30-bin.jar is not added to the CLASSPATH environment variable, resulting in SQL without driver files
2. When accessing SQL database, root password is incorrect, resulting in the inability to access SQL.
Issue: To avoid changing the program's root password each time you run the program, there is a way
1. My Computer-right-click, service-stop MySQL service
2. Add a skip-grant-tables command to the mysqld of the My.ini configuration file in the Programdata directory, the function of which is to skip permission validation and operate MySQL without verification.
3. Restart MySQL server: My Computer-right-click, service-start MySQL service
At this point, the user name and password in the program can access the SQL database arbitrarily
For example: change user name and password to "1", "1"
The results of the operation are as follows:
MySQL Run Error: Unable to connect driver, no root access solution