Create MySQL database with SSH command

MySQL databases can be created either through phpmyadmin or through the SSH command line

Lets see how to create a MySQL database with SSH command

(i) First log in to mysql with your user name (change if not root). You will be prompted for a password.

mysql -u root -p

(ii) create the database with a unique name

CREATE DATABASE new_database;

(iii) The user “root” (or whoever is logged in) has privileges to the database. To give another user, access, type the command

GRANT USAGE ON new_database.* to other_user@localhost IDENTIFIED BY 'otheruser_passwd';

(iv) If you want to give the other_user all the priviliges, type the command:

GRANT ALL  ON new_database.* to other_user@localhost;

(v) Now the other user can log in and access the database with the command

mysql -u other_user -p'passwd' new_database

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *