I need to convert a mysql database to postgres. Just for testing, I installed a local mysql database and created a simple test database with one table. Now I wan't to make a SQL dump with the option --compatible=postgresql:
mysqldump test --compatible=postgresql -uroot > ~/Documents/testdump.sql
But I always get the following error message:
Invalid mode to --compatible: postgresql
I'm using OSX and installed mysql using homebrew
the mysql version is: stable 8.0.12 (bottled)
I also tried it with the Docker-container and the newest version 8.0.12 but it also gives me the same error message. I need the compatible mode so I can use the dump with an python script to convert it to postgresql.
Edit:
I downgraded to 5.7 and it's now working - I'm still wondering why it's not working with the new version.
If you check the documentation for MySQL 8, you will find this:
--compatible=name
Produce output that is more compatible with other database systems or
with older MySQL servers. The only permitted value for this option
is ansi, which has the same meaning as the corresponding option for
setting the server SQL mode.
So setting the value of name to postgresql won't work.
https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_compatible
For 5.7 the following values are possible, which is the reason that a downgrade enabled you to use the desired value:
--compatible=name
Produce output that is more compatible with other database systems or
with older MySQL servers. The value of name can be ansi, mysql323,
mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options,
no_table_options, or no_field_options.
Related
When using DataGrip to connect to MySQL, there is a connection error. I know it can be solved by modify MySQL server configuration, but is there a client way?
[HY000][1193] Unknown system variable 'query_cache_type'
Are you using MySQL 8.0.3? The new version has removed support for the query cache (for good reason), and the variables that pertain to it.
https://dev.mysql.com/doc/refman/5.7/en/query-cache.html says:
Note
The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.
I just installed the latest DataGrip 2017.2.2 and the latest MySQL 8.0.3-RC and I can reproduce the error you report. I was able to use DataGrip fine with MySQL 8.0.1.
I have logged a bug with DataGrip: https://youtrack.jetbrains.com/issue/DBE-5212
Update: the JetBrains bug report referred me to this MySQL JDBC driver bug: https://bugs.mysql.com/bug.php?id=87846
TL;DR:
You need to use Connector/J 5.1.44 to connect to MySQL 8.0.3.
I followed these steps:
Download the free MySQL Connector/J 5.1.44 from https://dev.mysql.com/downloads/connector/
Open DataGrip's Data Sources inspector with Cmd-;
Select the MySQL driver
Uncheck the use of the bundles MySQL Connector/J
Click "+" to add a file, and select the MySQL Connector/J jar that I had downloaded
Restart DataGrip
Once I had done that, queries in DataGrip work against MySQL 8.0.3.
I changed the driver to MariaDB and that works for me.
Changing to the last version of MySQL didn't help.
I need to downgrade data from MySQL 5.7 to MySQL 5.1. are there any ways to do in simple steps? (backup and restore )T
There is a solution is step by step like downgrade from 5.7 to 5.6, and then to 5.5.
The Following link says step by step
Make sure you're not using features from 5.7, that are not avaliable in 5.1, for example utf8mb4 encoding (needed for emoji characters)
Then most safe option is to mysql_dump all databases via mysqldump, except for mysql (actually you need mysql.user table, but it's safer to recreate, other settings tables may and most probably will not fit)
Try restoring on staging server first, to see if restored db works the way you expect it to
Is it possible to use a newer version of mysqldump to export data that is compatible with older versions of mysql?
Specifically, I am using mysqldump to export data from version 5.5.44 to 5.1.55.
I was getting the error
Unknown collation: 'utf8mb4_unicode_ci'
when trying to import data from the 5.5.44 to the 5.1.55 server
I know in the manual, it says that the compatible option can be used with one of the following names: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, or no_field_options, but I'm not sure if that is what I want in this situation.
If I really wanted a sure-fire solution I would use mysql40 - 5.1 can definitely load a dump from 4.0, MySQL philosophy is backwards compatibility to a fault. However, it is quite likely to work as is - dumps have not changed very much between 5.1 and 5.5.
I do plan to migrate the database from version 5.1 to version 5.6.
I want to do this by using mysqldump:
Export (by mysqldump) data from MySQL DB 5.1 to sql file,
Import (by mysqldump) this sql file that MySQL 5.6 database,
Do not have a complex database that migration can be associated with some risks?
What to look for?
I can not do update database from 5.1 a 5.6, because I can not stop the production base at this point.
Generally speaking it is safe (and supported) to upgrade using mysqldump.
My best suggestion is to use mysqldump from MyQSL 5.6 against the 5.1 server, as newer versions have quite a few fixes to ensure the correct order when dumping foreign keys and other bits and pieces. Your 5.1 version may have these fixes already, but using the newer version won't hurt in any case.
Ensure you run mysql_upgrade after importing the database into 5.6, and then restart the server, as per the MySQL upgrade guide:
http://dev.mysql.com/doc/refman/5.6/en/upgrading.html
Alternatively if you can update in two steps, you can do a in-place binary upgrade by first upgrading to 5.5.x before 5.6.x, ensuring to run mysql_upgrade during both steps.
I've scoured the MySql website to see if they have compatibility listings for MySQL Workbench, but have not found anything. Does anyone know if 6.0.x can connect to 5.5.x databases? I'd rather not install and then have to roll back.
MySQL Workbench can connect to most MySQL server versions, but that is probably not the primary question. You should rather ask what minimum version it can work with. MySQL Workbench requires at least MySQL 5.0 and can work with any MySQL server after that (including the new 5.7). Some features like authentication plugin or performance schema support require higher server versions, though.