如何从终端导入MySQL数据库? [英] How can I import a database with MySQL from terminal?
本文介绍了如何从终端导入MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从终端导入带有mysql的数据库?
How can I import a database with mysql from terminal?
我找不到确切的语法。
推荐答案
假设您使用的是Linux或Windows控制台:
Assuming you're on a Linux or Windows console:
提示输入密码:
mysql -u <username> -p <databasename> < <filename.sql>
直接输入密码(不安全):
Enter password directly (not secure):
mysql -u <username> -p<PlainPassword> <databasename> < <filename.sql>
示例:
mysql -u root -p wp_users < wp_users.sql
mysql -u root -pPassword123 wp_users < wp_users.sql
参见:
注意:如果你在然后你必须在执行命令之前将 cd
(更改目录)到CMD内的MySQL / bin目录。
Note: If you are on windows then you will have to cd
(change directory) to your MySQL/bin directory inside the CMD before executing the command.
这篇关于如何从终端导入MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文