Log in with MySQL, connect to the database
Win+r Open the console, cmd into the console, enter mysql -u root -p
, enter the password, enter the database;
First, you can view the original database, enter
show databases;
OK, now start creating a new database, named CrashCourse,
create database crashcourse;
Since the teacher provided two SQL files during class, the SQL file is imported into the database, and the statement at the time of import
source e:/create.sql;
,source e:/populate.sql;
Here, after the source is the file storage location, import need to select the database use crashcourse;
, otherwise error, precedent
Next, you can view the contents of the database, for example, show the table in the database, you are happy:)
show tables;
To return each field of the specified table, show columns:
show columns from customers;
=describe customers;
show status;
Displays extensive server status information (there will be a lot of bars)
show grants;
Display security permissions granted to a user
Show errors;
Display server error or warning message
help show;
the input displays the allowed show statements:
Summary
How to connect and log into a database, select a database with use, view MySQL database, tables, and internal information with show
SQL: Login, connect to database basic operations