Inter-professional mastery in 8 hours to realize the work of computer graduates

In the morning, the first ray of sunlight shines into reality. As a computer developer with two years of experience, relying on the knowledge of image processing, the company took me in. However, I understand that I don’t even understand the database. How can I be mixed for a long time?

So, I grabbed a post from a big guy, created a mirror image of a tiger and a cat, and wrote this article. For those who are facing graduation difficulties, a gift from Dabai.

0 Reference core link:

Library Management System (Java MySQL)

1 Questions and answers for the author of the work:

(1) First of all, I wrote this in Java, the mysql for the database, the user name and password of the library management system are stored in the user table in the mysql database (db_books), the user name is root, the password is root, if this If you use my database (db_books), there is no need to change it. The user name and password in the DBuril class (the class for connecting to the database) are the user name and password that you set to connect to the mysql database when you install mysql. Mine is also the user name: root, password: root, this may be everyone’s They are all different and may need to be changed.


(2) How to run this program: Enter the first package (pers.cyz), click BookMagange.java, and after the code is displayed, pull down and you will see that this file contains the main method, and then click Run on this page to run it

2 My expansion:

Database connection, solve the problem of Unknown database'db_books'.

mysql -uroot -p SET names utf8mb4; show databases; create database db_books; show databases; use db_books; source C:/Users/pgjgg/Desktop/javaProject/图书管理系统/数据库文件/db_books.sql;

3 Problems encountered in the process:

3.1 mysql -uroot -p error.

The original mysql8.0.20 database password is forgotten. After deleting it completely, reinstall the mysql8.0.13 database.

New database system:

The account is: root

The password is: root

Reference link:

mysql complete uninstall tutorial (graphic details)

Clean uninstall mysql, personal test, this time finally succeeded

Windows 10 system MySQL 8.0.13 download and installation tutorial

3.2 java.sql.SQLSyntaxErrorException: Unknown database'db_books'

Solution: Import the sql file into the database

mysql -uroot -p

show databases;

create databases db_books;

show databases;

use db_books;

source C:/Users/pgjgg/Desktop/javaProject/Book Management System/Database File/db_books.sql;

mysql -uroot -p show databases; create database db_books; show databases; use db_books; source C:/Users/pgjgg/Desktop/javaProject/图书管理系统/数据库文件/db_books.sql;

Reference link:

How to import sql files in mysql

3.3 ERROR 1366 (HY000): Incorrect string value:'\xA6\x82\xE4\xBD\x95\xE9...' for column'book_name' at row 1

drop database db_books;SET names utf8mb4;create database db_books default character set utf8mb4 COLLATE=utf8mb4_0900_ai_ci;show databases;use db_books;source C:/Users/pgjgg/Desktop/javaProject/图书管理系统/数据库文件/db_books.sql;

Error demonstration:

create database db_books default character set utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

3.4 The database's own system account and password are forgotten, which will cause a branch copy and reset the database password.

The solution is to completely delete the unsuitable database version for which the password is forgotten, and then select a suitable version to reinstall.

Detours and tried the following three methods to solve the database password reset, death:

3.4.1 Delete the data folder, C:\Program Files\MySQL\MySQL Server 8.0\data\

3.4.2 Modify the [mysqld] keyword in the my.ini file and add skip-grant-tables under mysqld

3.4.3 Open a cmd with administrator authority and input: mysqld --initialize --user=root --console, and then open a cmd with administrator authority to modify the password: ALTER USER'root'@'localhost' IDENTIFIED BY'password' ;, Close the two interfaces of cmd, and then enter mysql.

Reference link:

mysql reset password

Solve the problem of 1251- Client does not support authentication protocol error when Navicat for MySQL connects to Mysql 8.0.11

table of Contents

0 Reference core link:

1 Questions and answers for the author of the work:

2 My expansion:

3 Problems encountered in the process:

3.1 mysql -uroot -p error.

3.2 java.sql.SQLSyntaxErrorException: Unknown database'db_books'

3.3 ERROR 1366 (HY000): Incorrect string value:'\xA6\x82\xE4\xBD\x95\xE9...' for column'book_name' at row 1

3.4 The database's own system account and password are forgotten, which will cause a branch copy and reset the database password.

3.4.1 Delete the data folder, C:\Program Files\MySQL\MySQL Server 8.0\data\

3.4.2 Modify the [mysqld] keyword in the my.ini file and add skip-grant-tables under mysqld

3.4.3 Open a cmd with administrator authority and input: mysqld --initialize --user=root --console, and then open a cmd with administrator authority to modify the password: ALTER USER'root'@'localhost' IDENTIFIED BY'password' ;, Close the two interfaces of cmd, and then enter mysql.