1

I have set up Ubuntu Server 11.10, and plan to host my website on it. Until this point I was using UniServer to host it in a portable fashion. Using the built in MySQL. This is fine, and through testing, I have gathered a decent amount of info in my database that I really don't want to have to re-enter.

The problem is; that I cant find any help online to install the existing databases into MySQL on the Ubuntu side of things. I can Export the existing databases from UniServer, no problem. But once I've copied them over to Ubuntu, how do I get MySQL to read them.

For anyone that doesn't know, Ubuntu Server is a Command Line Interface OS. While I do have a Debian Graphical User Interface installed (accidentally), it doesn't allow much to be done graphically, other then file system search, copy, cut, paste, etc. Terminal application, and a minimalist web browser.

Any help that can anyone can give here is greatly appreciated. I am a Linux newbie, so simplified jargon is also appreciated, but I am very eager to learn!

2 Answers 2

1

The simplest option is to just back up everything in the filesystem and carry it over.

To find out where your data is, look at the datadir variable with in mysql

test> show variables like 'datadir';
+---------------+-------------------+
| Variable_name | Value             |
+---------------+-------------------+
| datadir       | /var/lib/mysql/   |
+---------------+-------------------+
1 row in set (0.00 sec)

Note Your actual value may differ.

Then from your shell shut down mysql, back it up and copy it over. Something like:

> sudo service mysql shutdown
> cd /var/lib/mysql
> sudo tar -czf /path/with/enough/space/db.tgz *

Copy your db.tgz over to your new server and uncompress it on your new servers datadir while it is shutdown

1

I am not familiar with UniServer, but from a cursory google search it appears you might be able to make a backup using phpmyadmin. If so, make the backup (google around on how to backup databases using phpmyadmin), copy the file to your ubuntu box, and on your ubuntu command line:

#> mysqladmin -uroot -p create yourdatabasename (if this has not been created already)
#> mysql -uroot -p yourdatabasename < /path/to/your_phpmyadmin_backup_file.sql

Try: man mysqldump for more options on importing and exporting your databases.

You could also install phpmyadmin on your ubuntu box if it makes it easier for you.
sudo apt-get install phpmyadmin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.