Yuya Kawahara
Yuya Kawahara

Reputation: 107

What does mysql -u root -p do?

I am trying to figure out what the mysql -u root -p command does.

I have googled the command but I can't find any good results.

Upvotes: 3

Views: 55205

Answers (4)

Viktor
Viktor

Reputation: 827

mysql -u root -p means, that you trying to connect to MySQL shell with parameters - -u parameter specified MySQL user name.

-u, --user=name User for login if not current user.

In your case it's root user.

-p, --password[=name] Password to use when connecting to server. If password is not given it's asked from the tty.

You can type mysql --help from the command line for more information about all available parameters.

Good luck.

Upvotes: 8

ghostprgmr
ghostprgmr

Reputation: 488

Check man mysql

Your command tries to connect to MySQL on localhost with user "root" and asking for a password

Upvotes: 0

Naveed Ramzan
Naveed Ramzan

Reputation: 3593

`mysql -u root -p`

Its initiate a connection of MySQL.

-u means that we are going to connect with a username root

-p means that we will enter username's password

Upvotes: 2

mayersdesign
mayersdesign

Reputation: 5310

It logs you into mysql as the root user. After -p (Immediately after it incidentally, no spaces) you would include the password.

Upvotes: 3

Related Questions