Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ubuntu服务器的mysql中导入数据库转储文件_Mysql - Fatal编程技术网

如何在ubuntu服务器的mysql中导入数据库转储文件

如何在ubuntu服务器的mysql中导入数据库转储文件,mysql,Mysql,我正在执行在ubuntu中导入sql转储的查询 mysql -u username - p passsword databasenme < var/www/sql.sql; error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u mysql-u

我正在执行在ubuntu中导入sql转储的查询

 mysql -u username - p passsword databasenme < var/www/sql.sql;
error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u
mysql-u用户名-p密码剑数据库me错误:您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,了解在“MySQL-u”附近使用的正确语法

在-p和密码之间不应该有任何空格

mysql -u username -p<PASSWORD HERE> databasenme < var/www/sql.sql;
mysql-u username-p databasenme
更新:


我以为你还没有登录到mysql。如果是,您应该退出mysql控制台,然后重试。

在-p和密码之间不应该有任何空格

mysql -u username -p<PASSWORD HERE> databasenme < var/www/sql.sql;
mysql-u username-p databasenme
更新:


我以为你还没有登录到mysql。如果是,您应该退出mysql控制台,然后重试。

您可以使用以下方法导入.sql文件:

mysql -u <user> -p<password> <dbname> < mysqlfile.sql
然后,您只需执行以下操作:

mysql>use your_db

mysql>SET autocommit=0 ; source the_sql_file.sql ; COMMIT ;

您可以使用以下方法导入.sql文件:

mysql -u <user> -p<password> <dbname> < mysqlfile.sql
然后,您只需执行以下操作:

mysql>use your_db

mysql>SET autocommit=0 ; source the_sql_file.sql ; COMMIT ;

您已登录到mysql。按ctl+z退出并重试。

您已登录到mysql。按ctl+z退出并重试。

不要在此行中写入用户密码,只键入标志-p,然后在新行中输入密码:

$ mysql -u user -p database_name < your_file.sql
Enter password: 
$mysql-u user-p database\u name
编辑:


检查.sql文件的语法,文件中可能有语法错误

不要在此行中写入用户密码,只键入flag-p,然后在新行中输入密码:

$ mysql -u user -p database_name < your_file.sql
Enter password: 
$mysql-u user-p database\u name
编辑:


检查.sql文件的语法,文件中可能有语法错误

如果您已从终端登录mysql,请首先退出。从家里发出命令。如果您已从终端登录mysql,请先点击exit命令。先退出。从家里发出命令。首先点击退出命令。我已重新登录到数据库并使用我的数据库,但当我启动查询时,会给出相同的错误。如果为用户设置密码,则必须添加-p参数,无论是在命令行还是在虚拟模式下指定。mysql-u yourUserName-poptionalyyourPassword\u no\u space\u here\u如果您指定一个-h localhostor无论您的数据库名是什么