JSP-使用命令行导入SQL文件到数据库
2019-12-29 本文已影响0人
肾仔博
使用Mysql命令控制台导入sql文件到数据库的操作:
1、首先进入到MySQL安装目录的bin文件下,在路径下输入:cmd,进入到控制台


2、然后输入mysql -u root -p:连接数据库,接着继续输入你的mysql的密码,则提示连接成功

3、查看自己mysql中的数据库:show databases;并选择其中一个数据库作为使用:use db_1;或者也可以新建一个数据库作为使用:create database boge;

4、之后最好是设置一下数据库的编码:set names utf8;

5、来到最关键的一步,找到存放着所需导入的sql文件的路径,并在控制台输入存放它的路径:source D:/eclipse/eclipse/DB_Course_Design-master/sql/student.sql; (这里注意路径中的 '/')

6、导入sql文件成功。
