Ubuntu create a new mysql database and run SQL files

First enter mysql:

mysql -u root -p
#root为mysql账号,之后输入自己的root密码

New database:

create database newdatabase;
#注意“;”分号

View the database:

show databases;

After creating a new database, I want to import the .sql file into the database:

use newdatabase;
# newdatabase为自己需要使用的数据库名称

Then source /path/a.sql (path to sql file)

Guess you like

Origin blog.csdn.net/whuzhang16/article/details/109261664