MySQL 在 EasyPHP 中使用 phpmyadmin 导入 sql 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18215379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:31:31  来源:igfitidea点击:

Importing sql file using phpmyadmin in EasyPHP

mysqldatabaseimporteasyphp

提问by Bridget Jones

I have a website written in php and mysql (written by someone else) and I need to alter it- just for your interest it is bridgetjonesart.co.uk. So I thought I would download it to my desktop pc and use easy php and mysql locally to make changes then upload it again.

我有一个用 php 和 mysql(由其他人编写)编写的网站,我需要对其进行更改 - 只是为了您的兴趣,它是 bridgetjonesart.co.uk。所以我想我会把它下载到我的台式电脑上,并在本地使用简单的 php 和 mysql 进行更改,然后再次上传。

I have the sql database as a file 'runningc_bjart.sql' in the root directory. I first use php admin to create a database of the same name as the orginal and then use import ... one table appears to be created but then getting an error... Error

我将 sql 数据库作为根目录中的文件“runningc_bjart.sql”。我首先使用 php admin 创建一个与原始数据库同名的数据库,然后使用 import ... 似乎创建了一个表,但随后出现错误...错误

SQL query: DocumentationEdit Edit

SELECT  `comment` 
FROM  `phpmyadmin`.`pma_column_info` 
WHERE db_name =  'runningc_bjart'
AND table_name =  ''
AND column_name =  '(db_comment)'

MySQL said: Documentation

#1100 - Table 'pma_column_info' was not locked with LOCK TABLES 
---------

Error
SQL query: DocumentationEdit Edit

SELECT  `comment` 
FROM  `phpmyadmin`.`pma_column_info` 
WHERE db_name =  'runningc_bjart'
AND table_name =  ''
AND column_name =  '(db_comment)'

MySQL said: Documentation

#1100 - Table 'pma_column_info' was not locked with LOCK TABLES 

I am not sure what to try next, any help would be really appreciated. Thank you. Bridget

我不确定接下来要尝试什么,任何帮助将不胜感激。谢谢你。布里奇特

回答by Bridget Jones

Having wasted many hours, I have a solution so here it is.

浪费了很多时间,我有一个解决方案,所以就在这里。

Having a look on the web I found I needed to change my config.inc.phpfile in the phpadmin directory as I was running EasyPHP 13.1 password slightly diff to that mentioned in the blog at http://amir-shenodua.blogspot.co.uk/2012/03/error-while-importing-db-in-mysql.html. I added 2 lines:

在网上查看我发现我需要更改config.inc.phpphpadmin 目录中的文件,因为我运行 EasyPHP 13.1 密码与http://amir-shenodua.blogspot.co.uk/2012/ 上的博客中提到的密码略有不同03/error-while-importing-db-in-mysql.html。我加了两行:

$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';

So all sorted !! Yippee!!

所以都排序了!!伊皮!!

So if you have trouble please read:
http://amir-shenodua.blogspot.co.uk/2012/03/error-while-importing-db-in-mysql.html

因此,如果您遇到问题,请阅读:http:
//amir-shenodua.blogspot.co.uk/2012/03/error-while-importing-db-in-mysql.html

回答by user3980196

For temporary relief:

临时救济:

Comment out this line in your config.inc.php file (place //before the line)

在 config.inc.php 文件中注释掉这一行(放在//该行之前)

$cfg['Servers'][$i]['pmadb'] = $dbname;

Then close all browsers. Try importing again.

然后关闭所有浏览器。再次尝试导入。

回答by Jeff Puckett

As an alternative to modifying phpMyAdmin's config.inc.phpas proposed in other answers, if you have shell access then you can directly execute this file using the MySQL console client.

作为config.inc.php其他答案中建议的修改 phpMyAdmin 的替代方法,如果您具有 shell 访问权限,那么您可以使用 MySQL 控制台客户端直接执行此文件。

First, change directories to the folder containing your DDL script runningc_bjart.sql

首先,将目录更改为包含 DDL 脚本的文件夹 runningc_bjart.sql

Then run this command, replacing the values for host, user, password, and database name:

然后运行此命令,替换主机、用户、密码和数据库名称的值:

mysql --host=database_server --user=database_user --password=database_password --database=database_name < runningc_bjart.sql

This ran just fine without the error received when importing via phpMyAdmin

这运行得很好,没有在通过 phpMyAdmin 导入时收到错误