Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Jan 11 '12 at 23:29

This question came from our site for professional and enthusiast programmers.

2 Answers 2

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.