# mysql -u user_name -p database_name for connecting to mysql

This is what I have seen in every example for logging into mysql.
\\ mysql -u user_name -p password\>
Today I got a message “database xyz not found” xyz is my password
so I changed -p to my database name
\\nutc@se # mysql -u user_name -p database_name\
after entering my password I got the mysql>
How can this be?

You need to provide the password after -p without space otherwise mysql thinks it is the database name.

mysql -u <user> -p<pass> <database>

Don’t ask me why it is like that.

1 Like

Thanks TeN, I would never have found that…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.