[英]MYSQL restore command saying I'm trying to restore to a different database?
Hey guys I'm trying to restore a database called "hs" but MYSQL is saying, I'm trying to restore a database "mysql" 大家好,我正在尝试还原一个名为“ hs”的数据库,但是MYSQL在说,我正在尝试还原一个数据库“ mysql”
I've su root
to get super user access, 我已经
su root
拥有超级用户访问权限,
[root@server init.d]# sudo mysql -u hs -p --database=hs < /home/hs/blankhsdb.sql
Enter password:
ERROR 1044 (42000) at line 1: Access denied for user 'hs'@'localhost' to database 'mysql'
Why could this be happening? 为什么会这样呢?
You interchange the variables there..you used 'hs' for user which is in your case, a database. 您在那里交换变量..您为用户使用了“ hs”,在您的情况下是数据库。
mysql -u #username# -p #database# < #dump_file#
Read this example syntax here.. 在此处阅读此示例语法。
http://www.techiecorner.com/31/how-to-restore-mysql-database-from-sql-dump-file/ http://www.techiecorner.com/31/how-to-restore-mysql-database-from-sql-dump-file/
Fixed it, 修复,
sudo mysql --database=hs < /path/to/filename.sql 须藤mysql --database = hs </path/to/filename.sql
maybe just a case of it getting confused as username and db are the same 也许只是因为用户名和数据库相同而感到困惑
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.