How do I know the engine number
WHY hydrogen peroxide sizzles

How to import a Mysql database

How to import a Mysql database

MySQL database management system is one of the most popular solutions for creating versatile and flexible storage services web-based application data.

Drivers to work with the MySQL database included in thethe vast majority of distributions modern CMS. For the majority of popular scripts and content management systems, databases exist with initial filling.

It is only necessary to import the mysql database to get started.

You will need

  • - Login credentials to access the server MySQL-
  • - Console client mysql.



Prepare MySQL database dump file. If the dump is located in the archive, extract it. Use an appropriate extractor or the possibility file manager.


Specify text encoding database dump, if it is not known in advance. Open the file in an editor or viewer, allowing dynamic change encodings. Choose the encoding of the document.


Connect to the MySQL server. Run the console client program mysql with the specified host name and user. The host name is specified with the parameter -h command line, and the user name - using -u. You can also specify the password on the command line to access the server using the -password key or leave this option without a value (if the password is requested at connection) .Vvedite console type the following command:
mysql -h HostName -u UserName -password = UserPassword
and press Enter. There HostName - Host name (it can be both symbolic and represent the IP-address), UserName - user name of the database, and UserPassword - password. If a successful connection to the console will display the message, and displays an invitation to enter commands.


Print a list of supported server setssymbols. In the console, type «SHOW CHARACTER SET-«. Press Enter. Determine whether installed on the server character set that corresponds to the coding, which contains data dump imported database.


Display the list of the existing databases. In the console, type «SHOW DATABASES-«. Press Enter.


Create a new base Data on the server MySQL. Enter the type of command:
and press Enter. As DatabaseName parameter to specify the desired database name. It should not coincide with the same name from the list printed on the fifth step. The parameter CharsetName specify the name of the character set corresponding to the encoding of the text database dump. List of character sets has been displayed on the fourth step. Instead CollateName substitute value from the «Default collation» corresponding line in the same list.


Disconnect from the server. Enter the console q. Press Enter.


import base MySQL. Enter in the console type the following command:
mysql -h HostName -u UserName -D DatabaseName -b -B -s -p & lt- filename
press Enter. Enter your user password. Press Enter. Wait until the import dannyh.Zdes values ​​-h and -u parameters are similar to those described in the third step. Instead DatabaseName is necessary to substitute the name created on the sixth step of the database. The value of the filename must be a full or relative path to the database dump. Error messages are displayed in the console.

Comments are closed.