导入导出mysql数据库遇到的问题

By SuperTaoer | 十二月 2, 2005
Under: 程序 技术 周边
Views:

今天转移数据库遇到了这样的一个问题,
因为mysql的版本以及编译的方法都一样,所以就直接copy数据库文件了。
然后用程序读取数据库遇到了这样的问题,
显示: Table ‘******’ is read only
刚开始以为是文件权限的问题,把copy过来的直接
chown -R mysql:mysql db
结果问题依旧,不得其解,后来去google搜索
终于知道了

原文是这样的:
The problem is that u have copied the database files while the MySql server was running,
the solution is to delete the database and turn off the server,
copy the files ,
change the ownership and then turn the sever on again

意思是说我在copy文件之前应该先把数据库停止,然后copy后在开启数据库服务器。

试验了一下,连接数据库成功 :)

所以感觉,
备份数据库的时候还是导出成sql文件比较保险,sql文件可以保证在不同版本的mysql服务器上兼容,而且导入也很快。

差..好文!! (还没评价)
Loading ... Loading ...

Leave a Message

No Messages

No Messages

RSS feed for comments on this post. TrackBack URI

Leave a Message