Importing mysql script file in different version - mysql

Currently, I am using mysql version 5.0.45 - community-nt. I have created tables in that database. After that, I export the script file from and I imported other mysql server. That version is 5.5.29. In my tables, there is BIT datatype. When I imported my exported data to other mysql version, the imported data are changed. Imported data are not correct. So, How shall I handle.

If you're exporting with the mysqldump command you can use the --compatible option. For some reason there isn't a mysql50 option but you can use mysql40 and it should work for you:
mysqldump -uuser -ppassword -hyour.host \
--compatible=mysql40 your_database > your_database.sql

Related

Import MySQL XML Dump?

I have dumped a MySQL database (all tables) for use with PHPUnit using this command:
mysqldump --xml -t -u [username] --password=[password] [database] > /path/to/file.xml
I need to modify the test data, so I need to re-import it back into the database so I can work on it with MySQL workbench.
What is the command to reimport it back into a specified database?
And no, it's not as simple as LOAD XML, that works on a table by table basis, but this export has all tables in it.
NO, there is no built in way present to restore a XML formatted dump file. You can check this blog Restoring XML-formatted MySQL dumps for information on this as well as this existing post How to restore a mysql xml database file from mysql command line?

data export error mysql workbench 6.3

I want to export the whole database using workbench. I keep getting the following error message. I used server>data export option in workbench.
This is a known bug in MySQL Workbench 6.3.5. Your options are to either (A) wait for an upcoming Workbench version to fix it, or (B) change your mysqldump binary (under User Preferences) to a different non-bundled mysqldump binary, likely one from MySQL Server 5.6.
You can easily dump the whole database from the command line:
mysqldump -u <db_username> -p -h <db_host> db_name > database_dump.sql

Can i import a .sql file from wamp to xampp?

i have a .sql file that was exported from wamp, my friend only uses xampp. Is it possible to import my .sql file to xampp?
Yes because the .sql file is most likely independent of the server stack.
Of course it is possible, when wamp give you a export of .sql, this file can be used with all standard web server. (xampp)
I think this may help
Depending on the tool and parameters used to create the .sql dump file of multiple databases, the file will normally have
CREATE DATABASE DBn...;
and
USE DBn;
statements that will allow your import to proceed without hiccups. For example, both the mysqldump command mysqldump command and phpMyAdmin's Export function for multiple database insert them.
Assuming you have exported with a sensible tool like those above, then you can import the database with a command line like this:
mysql -u username -p < dumpfile.sql
Your mysql username account needs to have appropriate privileges to, for example, create databases.
You can even run this command in a more familiar way by naming the startingDB database to use before running the commands in dumpfile.sql:
mysql -u username -p startingDB < dumpfile.sql

Combining two installs of mysql

Noobish questions
The StartupParameters.plist points to MySQL 5.5.27-community. When I run Querious, a database management application, and create a db, it adds the db to an older version - MySQL 5.5.18 (specifically to usr/local/mysql-5.5.18-osx10.5-x86_64/data).
Questions: how do I move the dbs in the older version of MySQL to the current one? If I do, and then delete the old MySQL directory, will I be ok or are there other changes which need to be made?
Thanks,
Cole
You should simply dump the old databases using mysqldump or similar. Then import those dumps into the new server. You should then be able to safely uninstall your old server and remove the directories.
This is a simple case of exporting the databases and then importing them to another. In your case, use mysqldump to export the database from the older server and use mysql import to import into the newer one.
It is okay to safely uninstall the older version once the database has been exported.
usr/local/mysql-5.5.18-osx10.5-x86_64/> mysqldump -u username -p database > exported.sql
(location of the newer db)>mysql -u username -p -h localhost database < exported.sql

How to keep backup of our database in MySql

I want to keep backup of my database and import it into different System? and how to make .dmp
or store file in MySql?
You can dump a database with the mysqldump command-line utility ; using a command like this :
mysqldump --user=USERNAME --password=PASSWORD --host=ORIGIN_HOST DATABASE_NAME > backup.sql
Then, as the backup is just a bunch of SQL instruction, importing it to another database is as easy as using the mysql command-line utility :
mysql --user=USERNAME --password=PASSWORD --host=DESTINATION_HOST NEW_DATABASE_NAME < backup.sql
And, as a couple of references to the relevant manual pages :
4.5.4. mysqldump — A Database Backup Program
4.5.1. mysql — The MySQL Command-Line Tool
and Chapter 6. Backup and Recovery
Read the manual. If there's something there that you're not sure about, ask a more specific question.