Dump a mysql embedded database into a SQL text file [closed]

冷暖自知 提交于 2019-12-08 00:53:44

问题


I have a mysql embedded database that I need to move into server. I know that for a server I can use mysqldump to backup the data into a SQL text file. But what option do I have for a embedded database?

Thanks, Carlos.


回答1:


I managed to dump the embedded schema. I got it from a Amarok tips page

libmysqld.dll enables to use mysql in your program without setting up a server or load a deamon. Also it creates the same files as the server (mysql directory, schema directory and ibdata1 file). So I put those files in a directory and told the mysqld linux deamon to use that directory as datadir:

mysqld_safe --user=mysql --datadir=/data/myEmbededDB --skip-grant-tables

--skip-grant-tables will allow to connect with any user or password

Because the server point to that directory now I can dump the embedded schema with mysqldump just like any other mysql schema. The same applies if you want to use WorkBench with a schema created with libmysqld.dll

Hope this help other confused libmysqld.dll users

:-)




回答2:


Make a dump with mysqldump — A Database Backup Program

Then run script with mysql — The MySQL Command-Line Tool

There are examples, but read about the options. For example for dumping procedures and functions you need to specify '--routines' option, for triggers '--triggers' option.

Also, you could do it with GUI tools. Try Backup/Restore tools or 'Generate Schema Script' in dbForge Studio for MySQL. Tools allow to select objects in a tree, it is more simply and obvious.



来源:https://stackoverflow.com/questions/5563366/dump-a-mysql-embedded-database-into-a-sql-text-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!