pronego > pronego Helpdesk > Wissensdatenbank

How to import or export SQL dumps via the mysql command console - Windows

Lösung Importing an SQL dump via the mysql.exe-application is a lot faster than importing via the good old phpMyAdmin web-interface, which takes the pain out of handling huge files.

Hit [WIN] + [R], type cmd and hit enter. The command console window opens.

If you don't have the path to your mysql binaries in your environment variables you will have to navigate there first using the cd console command:

cd c:\PathToWebServer\Mysql\bin>

Then execute the mysql-application and pass the appropiate parameters, as seen in the example below.

Be aware, that there is no space between the parameter identifiers -u and -p, and their corresponding parameter data.

Also note the lower-than operator < between the database name and the filename of the target sql-file.
Reverse this operator to export into that file instead!

# export sql dump to file
mysqldump -uUsername -pPassword DatabaseName > "C:\PathToSQLFile\hugeMySQLDump.sql"

# import sql dump from file
mysql -uUsername -pPassword DatabaseName < "C:\PathToSQLFile\hugeMySQLDump.sql"

There is a lot more you can do with the MySQL console. It does have some pretty useful interactive features. A good starting point to learn about them, is to login in to the mysql and asking for help:

# first login to the mysql shell
mysql -uUsername -pPassword

# you now have a new command prompt, which replaces your windows prompt:

# ask for help, like this:
mysql> help;

Quelle: http://blog.framethrower.de/content/how-import-or-export-sql-dumps-mysql-command-console
Artikel-ID: 63
Kategorie: pronego
Datum (hinzugefügt): 03.07.2013 11:25:00
Aufrufe: 457

<< Zurück

Powered by Help Desk Software HESK™