我把 mysql 恢复文件放在哪里?
我正在尝试将 mysql 数据库从具有 phpMyAdmin 的服务器迁移到不具有 phpMyAdmin 的服务器。我有一个从 phpMyAdmin 服务器导出的 .sql 文件,但不太确定从那里去哪里。在寻找答案时,我不断寻找说使用此命令的网站:
mysql -u USER -p DBNAME < dump.sql
但没有任何地方描述该文件应位于何处。它应该位于 var/lib/mysql 目录中吗?
感谢您的帮助。
I'm trying to migrate a mysql database from a server with phpMyAdmin to one that doesn't. I have a .sql file exported from the phpMyAdmin server, and am not quite sure where to go from there. While searching for an answer, I keep on finding websites that say to use this command:
mysql -u USER -p DBNAME < dump.sql
but nowhere describes WHERE that file should be located. Is it just supposed to be in the var/lib/mysql
directory?
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它可以在任何地方。如果不在当前目录中,则使用完整路径
(如果文件位于 /home/ 文件夹中)
It can be anywhere. Use full path if not in the current directory
(if the file is in /home/ folder)
编辑:感谢您的更正,TehShrike。
您可以在
-p
后跟用户USER
的密码 - 在这种情况下,选项p
和密码之间没有空格。否则,mysql会提示你输入密码。因此语法如下:如果数据库尚不存在,则必须登录 mysql 服务器并首先创建它(在上面的行之前):
EDIT: Thanks for the correction, TehShrike.
You may follow
-p
with the password for userUSER
-- in which case there is no space between the optionp
and the password. Otherwise, mysql will prompt you for password. So the syntax is like the following:If the database does not already exist, you will have to login to your mysql server and create it first (Before the above line):