Difference between revisions of "Cloud Hosting/MySQL import export"

From XMission Wiki
Jump to: navigation, search
 
Line 82: Line 82:
 
[[Category:Hosting Troubleshooting]]
 
[[Category:Hosting Troubleshooting]]
 
[[Category:Getting Started]]
 
[[Category:Getting Started]]
 +
[[Category:Cloud_Hosting]]
 
{{:Cloud Hosting}}
 
{{:Cloud Hosting}}

Latest revision as of 15:54, 16 November 2016

MySQL dump (Export)

  • mysqldump is a tool used to dump a database or a collection of databases for backup or transfer to another SQL server. It can be used to migrate databases to and from your Cloud Servers.


General

  • Simply put, mysqldump outputs the SQL statements that were used to create a database, tables and all of the data in the tables. It can output these statements in multiple formats and with more or less output information as needed.


Usage

  • Since mysqldump just outputs SQL statements it is usually helpful to truncate the output to a file. A common mysqldump may look like this:
mysqldump -h localhost -u <user> -p databasename > databasefile.sql

Looking at this command piece by piece makes it easy to understand.

mysqldump: invokes the mysqldump command
-h localhost: specifies the host to use (if left out mysqldump will default to localhost)
-u <user>: specifies the user to login to mysql as. DO NOT INCLUDE < >
-p: tells mysql to ask for a password
databasename: specifies which database to dump
> databasefile.sql: truncates the output of the mysql command to a file

Switches


Helpful Tips

  • The -D switch can be used to dump a skeleton of a database without any data in it.
  • The --add-drop-table switch will ensure that when the SQL is uploaded to another SQL server it drops the tables before creating them.


Import MySQL

Just like mysqldump to export a database we can use mysql to import a database. Here is how it works:

  • The quickest way to do this is from the command line. Especially if the file is larger than 2Mb.
  • First you will want to make sure the file is located on your server. A program like Filezilla can be used to FTP your database file to your server.
  • SSH to your server with a program like Putty, for Windows, or Terminal on Mac or Linux.
  • Be sure you are in the directory containing the file you want to import.

Usage

  • From the command line you will want to enter the following:
mysql -h localhost -u <user> -p databasename < databasefile.sql

Looking at this command piece by piece makes it easy to understand.

mysqldump: invokes the mysqldump command
-h localhost: specifies the host to use (if left out mysqldump will default to localhost)
-u <user>: specifies the user to login to mysql as. DO NOT INCLUDE < >
-p: tells mysql to ask for a password
databasename: specifies which database to dump
< databasefile.sql: tells mysql to import a file called databasefile.sql

Cloud Hosting - Getting Started

To manage your Cloud Server, you will access the XMission Cloud Hosting Control Panel

For assistance in navigating your XMission Control Panel, please visit

Secure your Website

What is a SSL Certificate and How does it work?

Please vist to review a quick overview on why securing your website is a good idea.

Protect your Website

If you would like to learn how to control access to your server Click Here

  • XMission does recommend consulting a PHP or Apache Developer to ensure your .htaccess file is configured correctly. This could block total access to your Cloud Server.

FTP Access

FTP Access is typically recommend to connect to your Cloud Server. XMission requires SFTP Access to all hosting servers and suggests using FileZilla. To get help with acessing your server via FTP Click Here

SSH Access

From time to time you may need or want to use the command line to log in to your server. Your Cloud Server is accessible via a Secure Shell Interface also referred to as SSH. For help accessing your server via SSH please Click Here

Server Logs

You may need to look at your server logs. These can be access via SSH or FTP. To locate those logs Click Here

Scheduled Tasks

Cron enables users to schedule jobs (commands or shell scripts) to run automatically at a certain time or date. Some best practices to setting up Cron's:

Migrating MySql

If you are moving an excising website to your XMission Cloud Server, a MySql Database is most likely needed. If you'd need some help importing that database please Click Here

Cloud PHP Info

XMission's Default PHP Info for your Cloud Server: PHP Info

Host Files

How to set up Host Files

SSH Keys

SSH keys allow users to SSH to servers with a more secure method rather than having to rely on passwords alone. To set up SSH Keys Click Here

Server Security

For customers that sign up for Unmanaged Cloud Servers, XMission strongly recommends a few easy steps to take to ensure that your unmanaged Cloud Server stays up-to-date and secure at all times.