- Configuration of environment variables: If you are familiar with your computer, you will know that the reason why your computer supports system commands so honestly is because of the relevant configuration in environment variables, so your default command traversal location is C: \WINDOWS\system32> command, then if you want to use your mysql command directly, you must configure the following in the system environment variable
Of course, you can also not configure it, then you need to go to your command by yourself:
1. Start
- Log in to C:\WINDOWS\system32>mysql -uroot -padmin (administrator mode is used here)
If the following error occurs,
- It means that your mysql software is not self-starting, you can choose to set it to self-starting in the program settings. It can also be opened with the following command when the mysql server is closed: C:\WINDOWS\system32>net start mysql;
If the following prompt appears, it means that the mysql database has been successfully started
After the server is started, you can log in: -- The result of successful login is as follows
2, the basic operation of the database;
- Show existing databases: mysql> show databases;
The result is as follows:
- Drop database: mysql>drop database user; (user database name)
At this point you are looking at your database and you will find that the database user is gone:
- Create a database: mysql>create database aimme; (aimme database name)
Before creating a table, you must tell mysql which database you want to perform table operations on:
How to specify it? mysql has a command to use the database: mysql>use aimme; (aimme database name)
- Display all tables in the database: mysql> show tables;
The mysql server is shut down: C:\WINDOWS\system32>net stop mysql