Importing a MySQL database: Difference between revisions
>Samthecrazyman m Small format changes |
>Samthecrazyman m Changed numbering to bullet points |
||
| Line 8: | Line 8: | ||
== Importing your database == | == Importing your database == | ||
* If not at the console shell, open a console shell (Konsole in KDE) | |||
* First we need to use the main MySQL administration program. To run this type the following:<code># mysql -u [username] -p</code>For example, to login as root, type the following:<pre># mysql -u root -p</pre> | |||
* Enter your password when prompted. | |||
* At the MySQL prompt type the following:<pre>mysql> create database [database name];</pre>For example, to create the database named 'wikidb' type:<pre>mysql> create database wikidb;</pre> | |||
* If successful, you should see the following response:<pre>Query OK, 1 row affected (0.00 sec)</pre> | |||
* Now close MySQL by typing:<pre>mysql> exit</pre>MySQL will return<pre>Bye</pre> | |||
* At the console shell type the following:<pre># mysql -u [username] -p [database name] < [path to file/file.sql</pre>For example, if the username is root, the database name you just created is wikidb and the path the the dumped SQL file is the Linux root home directory, type the following:<pre># mysql -u root -p wikidb < /root/Documents/wikidb.sql</pre> | |||
* Once you have typed and entered the password, it may look like nothing is happening, be patient, it can take a while to import the database, especially if it is a large database or the computer is slow. | |||
* When the import is finished you should be returned to the console shell. You may want to use the MySQL administration program to check if the data was impoted OK. | |||
* You database has now been imported! | |||
== Troubleshooting == | == Troubleshooting == | ||