Mysql prompts that access is denied when adding a library (download and install mysql)

Today I want to add a library to mysql and do some exercises on the table

The sql is as follows: CREATE DATABASE wjtest; #New library

After running, there is a prompt message:

It is caused by the fact that mysql is not installed on the computer, so you need to download a mysql first (Win10 system Lenovo as an example)

https://www.mysql.com/     mysql official website URL

After downloading, unzip and copy the path 

run cmd as administrator

cd to the bin directory

The following is the prompt for successful installation of the installation service

Next enter mysqld --initialize --console to initialize mysql

After the initialization is successful, there will be a password to pay attention to

net start Mysql start service

Log in to test whether it has been installed and configured: enter mysql -u root -p and press Enter to copy the password above and press Enter

Modify password: alter user 'root'@'localhost' identified by 'new password';

exit at startup once

Enter the password you just updated: 123456

The installation is complete.

Encountered when connecting: Authentication plugin 'caching_sha2_password' cannot be loaded  error because: the encryption rules have changed 

Use: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; Reset the password and connect to OK

Go back to the original question and create a new library

reboot   

new library    

create table userinfo(
id int COMMENT'primary key id',
user_name char(10) COMMENT'user name',
city_id int COMMENT 'city id',
user_status int COMMENT 'user status',
creat_time DOUBLE COMMENT'add time');

Create a new table 

Then create some data. . You can start typing sql!

Guess you like

Origin blog.csdn.net/qq_50441416/article/details/117023369