How to Create a MySQL Database Using SSH

Login Database.
mysql -u root mysql -p
Create Database.
CREATE DATABASE dbname;
Create Database User.
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'password';
Give permission for dbname on db user.
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost';
Notice changes and reload the grant tables immediately.
FLUSH PRIVILEGES;

Leave a Reply