0

I have install MySql and now i am trying to get into the prompt of mysql with this command:

mysql -host localhost -p

but I am getting this error

ERROR 2005 (HY000): Unknown MySQL server host 'ost' (2)

2 Answers2

2

Your command line should be:

mysql --host=localhost -p

From the mysql man page:

   ·   --host=host_name, -h host_name

       Connect to the MySQL server on the given host.
  • this commands asks for password and after entering the pasword it gives this error "ERROR 1045 (28000): Access denied for user 'ifkaar'@'localhost' (using password: YES)" – M.Ahsen Taqi Feb 09 '15 at 13:26
  • 1
    @M.AhsenTaqi: Access to your database is a different problem. You should start a new question and close/accept this one. Try to look at http://askubuntu.com/questions/489098/unable-to-reset-root-password-of-mysql if you can't use your password. – Sylvain Pineau Feb 09 '15 at 13:33
0

Seems like ost was not defined in /etc/hosts (assuming that's what your using for -host based on error)

Would be something like

 ost     192.168.1.x

To be sure this is the problem, you can try to connect with ip address, rather than hostname and if that works, just edit

 /etc/hosts 

As directed, with proper address

geoffmcc
  • 1,334