This tip would be handy if you have access to SSH for your newly bought dedicated server, cloud server or vps hosting.
When you have access to database via SSH in your web hosting account, you can easily and swiftly copy, export, import databases between your different production or staging servers. Additionally when your sql files are huge, this procedure can assist to export and import sql much faster.
Assuming you know how to login to SSH.
When you have access to database via SSH in your web hosting account, you can easily and swiftly copy, export, import databases between your different production or staging servers. Additionally when your sql files are huge, this procedure can assist to export and import sql much faster.
Assuming you know how to login to SSH.
Login to MySQL
First we'll login to the MySQL server from the command line with the following command:mysql -u root -pExample:
mysql -u email88 -p zadmin_email88In this case, I've specified the user root with the -u flag, and then used the -p flag so MySQL prompts for a password. Enter your current root password to complete the login.
If you need to change your root (or any other) password in the database, then follow this tutorial on changing a password for MySQL via the command line.
You should now be at a MySQL prompt that looks very similar to:
mysql>or
MariaDB [(none)]>Show (View) All MySQL Databases
To view the database you've created simply issue the following command:SHOW DATABASES;Your result should be similar to this:
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)How to exit
Just type the text 'exit' like below to exit mysql.
MariaDB [(none)]> exit
Bye
Comments
Post a Comment