I have a zip file for a Windows MySQL 4.x installation database which includes the MySQL files and the databases files (.myi, .myd, frm). I have a Windows MySQL 5.0 running installation.
I need to bring one of the databases from the zip file to life in the current active MySQL 5.0. How can this be done?
With your first database running in your mysql 4 database, run a mysql dump
mysqldump dbname > dbname.sql
Then load that file up in your mysql 5 database...
mysql -e "create database dbname"
mysql dbname < dbname.sql
Of course you'll have to set up your users manually.
Related
We have around 20 GB of backup data. we took backup using by below command in MySQL 5.5 Server.
mysqldump -u username -p password (database Name) > Backupfile.sql
Now we are trying to restore same data in MySQL 5.7 Server. after immediate installation of MySQL 5.7.
It's taking huge time to restore the data.
We did search in google, we found this.
https://serverfault.com/questions/146525/how-can-i-speed-up-a-mysql-restore-from-a-dump-file
But its not helping.
Is there any other way to speed up this restoration process.
Thanks...
Let's say I remote from my workbrench to the database which is on server now for some reason I need to have copy of the database on my another computer as a local database. How can I do that?
Export it to a single file (whatever.sql), then import it by running the script on your local computer.
There's a "Data Export" link on the left side if you connect to the remote server using MySQL Workbench. Click on that and go through the export process. Then connect to your local server, click on "Data Import/Restore", and choose the file you just saved.
First export data from database, then import database or specific table import in local server.
$ mysqldump -u [uname] -p[pass] [dbname] > [backupfile.sql]
To dump all MySQL databases on the system, use the --all-databases shortcut:
$ mysqldump -u root -p --all-databases > [backupfile.sql]
Source :How to Copy (Backup) a MySQL Database
In addition to a dump and restore you can try the MySQL Workbench migration module which allows to migrate from MySQL to MySQL (useful for instance to upgrade from a previous version or to copy a schema, as in your case).
MySQL Workbench migration (general description, video tutorial, white paper): http://www.mysql.com/products/workbench/migrate/
The MySQL Workbench migration wizard: http://dev.mysql.com/doc/workbench/en/wb-migration-wizard.html
Moving from an old Win2003 server to a new VM server (our choice Win or Linux)
if we go Linux would there be any problems converting the current tables?
Moving MySQL/Windows to same version of MySQL/Linux
You can mysqldump all the databases as follows:
C:\> mysqldump -uroot -p --routines --triggers --flush-privileges --all-databases > MySQLData.sql
Move MySQLData.sql to Linux box and run the reload
mysql -uroot -p < MySQLData.sql
Moving MySQL/Windows to higher version of MySQL/Linux
You can mysqldump all the databases EXCEPT THE mysql SCHEMA !!! Why?
MySQL has the grants for the user in a main table called mysql.user.
For each major release of MySQL, mysql.user has the following number of columns:
43 columns in MySQL 5.6
42 columns in MySQL 5.5
39 columns in MySQL 5.1
37 columns in MySQL 5.0
31 columns in MySQL 4.0/4.1
I have discussed mysql.user's column arrangement before
May 01, 2013 : Can I find out what version of MySQL from the data files?
Dec 24, 2012 : Backup and restore "mysql" database
Jun 13, 2012 : Fastest way to move a database from one server to another
Feb 08, 2012 : will replication from 5.5.20 to 5.0.XX server work?
Here is a Windows Batch Script to mysqldump all databases except the mysql schema and then dump the mysql schema in pure SQL:
rem
rem Startup Settings
rem
set MYSQL_CONN=-uroot -prootpassword
set MYSQLDUMP_OUTPUT=C:\LocalDump.sql
set MYSQL_USERGRANTS=C:\LocalGrants.sql
set MYSQL_TEMPGRANTS=C:\TempGrants.sql
rem
rem Get MySQL User Data
rem
set MYSQLDUMP_OPTIONS=--routines --triggers --databases
set SQLSTMT=SELECT CONCAT('mysqldump %MYSQL_CONN% %MYSQLDUMP_OPTIONS% ',DBList)
set SQLSTMT=%SQLSTMT% FROM (SELECT GROUP_CONCAT(schema_name SEPARATOR ' ') DBList
set SQLSTMT=%SQLSTMT% FROM information_schema.schemata WHERE schema_name NOT IN
set SQLSTMT=%SQLSTMT% ('information_schema','mysql','performance_schema')) A
echo echo off > C:\RunLocalDump.bat
mysql %MYSQL_CONN% -ANe"%SQLSTMT%" >> C:\RunLocalDump.bat
C:\RunLocalDump.bat > %MYSQLDUMP_OUTPUT%
rem
rem Get MySQL User Grants
rem
set SQLSTMT=SELECT CONCAT('SHOW GRANTS FOR ''',user,'''#''',host,''';')
set SQLSTMT=%SQLSTMT% FROM mysql.user WHERE LENGTH(user)
echo %SQLSTMT%
mysql %MYSQL_CONN% -ANe"%SQLSTMT%" > %MYSQL_TEMPGRANTS%
mysql %MYSQL_CONN% -AN < %MYSQL_TEMPGRANTS% > %MYSQL_USERGRANTS%
del %MYSQL_TEMPGRANTS%
Once you create the mysqldump and the Grants File, simply copy them to the Linux Server execute them locally. Execute the mysqldump first. Then, load the grants.
Give it a Try !!!
You would not need to convert the tables. The SQL dump from the Windows server would be easy to import into MySQL on Linux.
No the tables will be fine. You should also be able to transfer the config files over without issue
using mysqldump and then just the mysql command to restore the backup
You can export your database (tables with data). Then you will get sql script file. If you run that script file in your new system your tables and data will be available in the new system
I have a Joomla database that was dumped into a .txt file on an appache server using the command:-
mysqldump -u admin --opt -p passwd > private/alexthekiddb.txt
How do import that into a new MySQL database on my IIS server so I can attempt a conversion from Joomla to Wordpress.
I can use phpmyadmin or the MySQL builtin command line tool.
I already have a 2nd new database created with the same name and user (and PW) as the original.
Normally, just running mysql private/alexthekiddb.txt or mysql < private/alexthekiddb.txt should be enough. Hence, such dump files are usually suffixed .sql
Of course, you should have a MySQL server on the target machine (IIS thing).
I have an online sql database which is used by a PHP web-script.
I'm working with someone who is managing a local database on their computer.
I need a way to replace the content of my online sql database with the updated version from the computer, preferably using Windows Command Line. How can I do this?
You could use the mysql utilities to do this. mysqldump will create a backup of the updated database and then you can feed that into your online database using the mysql utility.
C:>mysqldump -uUSER -pPASSWORD DATABASE > database.sql
C:>mysql -hHOST -pPORT -uUSER -pPASSWORD DATABASE < database.sql