Basic MySQL Commands

You can launch MySql screen by calling it using this simple command:
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:

**change databasename with your own database name. You better not use space in the name.
3. Create New MySQL User and Grant Access To Database
The most common syntax used to do that task is:
GRANT ALL ON databasename.* TO sqluser@localhost IDENTIFIED BY ‘password’;

4. Most Common Command Syntax

Which version is the MySQL server installed?A: You can find out which version is the MySQL currently installed on your server by using this simple command:
mysqladmin -u root -p version
I want to see all databases. How to list database?
A: You can retrieve all SQL database name using this command:
show databases;
Q: How to connect and access remote MySQL server?
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 -p databasename
– mysqluser is the username of remote MySQL, change this.
– is the host location, change this.
– databasename is the database name, change this.

Satu Tanggapan

  1. I don’t know if it’s just me or if everybody
    else encountering problems with your website. It appears
    like some of the text in your content are running
    off the screen. Can somebody else please comment and let me know if this is
    happening to them as well? This may be a issue with my browser because I’ve had this happen before.

    Many thanks

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s

%d blogger menyukai ini: