mysql -u MYSQLUSER -p
**replace “MYSQLUSER” with your own user. If you are the first time using MySQL and/or never created new user before, simply use “root” to login. MySQL user account is different from UNIX/Linux login account. You have to create it first and I’ll tell you that below.
Type that command then hit enter and you should be asked to enter password. Once you are in MySQL environment, you can go out from there by using “\q” or type “quit” command.
2. Create New Database
How to create new MySQL database via SSH? You have to enter MySQL screen and login, use command in step 1 above. Once you are logged in, type this to add new database in MySQL:
GRANT ALL ON databasename.* TO sqluser@localhost IDENTIFIED BY ‘password’;
4. Most Common Command Syntax
mysqladmin -u root -p version
A: You can retrieve all SQL database name using this command:
A: Yes you can do that via SSH and your server. But obviously you have to know the username and password to login to that remote MySQL server then use this command:
mysql -u mysqluser -h mysql.server.com -p databasename
– mysqluser is the username of remote MySQL, change this.
– mysql.server.com is the host location, change this.
– databasename is the database name, change this.