≡ Menu

mysql command

How do I specify or run MySQL or MariaDB SQL queries on the UNIX or Linux command line?
[click to continue…]

Restore a backup of a MySQL Database Server

Q. How can I restore a backup of a MySQL database server made with mysqldump program discussed here?

A. You can use standard mysql - the MySQL command-line tool to restore a backup of a MySQL database server.

Read back dump file

You can read the dump file back into the server like this:
mysql db-name < backup-file.sql To restore database called sales, first create the database sales: $ mysql -u root -p
Now create database called sales using SQL statement:

mysql> CREATE DATABASE sales;
mysql> quit;

Now restore database, enter:
$ mysql -u root -p sales < /path/to/sales-backup-file.sql

MySQL Change a User Password

I would like to change a password for a user called tom using UNIX / Linux command line option. How do I change a user password under MySQL server?
[click to continue…]

Create a MySQL Database, Tables and Insert Data

How do I create a MySQL database, tables, and insert (store) data into newly created tables?
[click to continue…]

MySQL command to show list of databases on server

Q. I am new to MySQL database server. How do I show the list of databases on my server? Is there any good GUI frontend exists for the same?
[click to continue…]

How can I import a MySQL dumpfile into my database? I'm using CentOS Linux 5 server. My old hosting provider gave me a data.sql file and I do have access to my Unix / Linux server via ssh. So How do I restore my data using command line over the ssh session?
[click to continue…]

Q. I made MySQL backup using mysqldump -u user -h localhost -ppassword forumdb | -gzip -9 > forumdb.sql.gz command. How do I restore MySQL database backup using a shell prompt under Linux / UNIX operating system?
[click to continue…]