I am writing below command to login MySQL
$mysql -u root -p root
But I'm unable to login and terminal show me message
ERROR 1049 (42000): Unknown database 'root'
Anyone know, How to login MySQL using terminal?
I am writing below command to login MySQL
$mysql -u root -p root
But I'm unable to login and terminal show me message
ERROR 1049 (42000): Unknown database 'root'
Anyone know, How to login MySQL using terminal?
Try this, remove "root" after -p tag, because here root is database name not password
mysql -u root -p
So you have Two option to login MySQL,
mysql -u root -p It will login for whole Databsemysql -u root -p [database name] it will login for particular database For further learning you can refer this dcumentation
The command you tried actually tries to use a database called root inside that mysql server. Such database apparently does not exist, which is why you get the error.
Instead simply try: mysql -u root -p
You will be asked for the password in an interactive manner.
If no password has been set yet (fresh install), then just try: mysql -u root
To learn about such things you really have to start reading documentations. A good starting point is the "man pages" typically installed on unixoid systems which offer a wealth of information on each available command. Just try a man mysql! It specifically shows the commands syntax right at the beginning: mysql [options] db_name. So the command accepts options (the -u <username> and the -p) and then an optional database name.