View Full Version : Problem with using mysql

April 22nd, 2008, 06:41 PM
I recently installed mysql using the following url:

And I simply used the following commands:
sudo apt-get install mysql-server
sudo apt-get install php5-mysql

I used the official mysql tutorials to try to figure out how to start using it, but I simply don't know how to start using it.
I used to following url to get me started.

It gives me the command
mysql -h host -u user -p

My problem is, I have installed mysql on my own Ubuntu computer, but I can't figure out for life of me, what my hostname is. I have tried my user name which is root, and many other combinations.

I know the SQL language, I just need to know how to actually use mysql on my own computer, and how to log into it. Any and all help is appreciated.

Thank You


Dr Small
April 22nd, 2008, 06:45 PM

Um, user@hostname.
Or, type:


April 22nd, 2008, 06:47 PM
user: root
password: the one you set up on the install.
host: localhost or or even the name of your computer.

If you ignore the -h flag, then it will assume it's local host.

And if you want a fancier UI, you can install mysql-admin, which adds a shortcut on Applications>Programming with the mysql admin client.

Host is used when you're connecting a remote server.

April 22nd, 2008, 07:03 PM
I have typed hostname command and gotten my hostname.

when I type:
mysql -h myhostname -u myusername -p
I get the error
Can't connect to MySQL server on myhostname.

I know that I typed my password correct, my username is correct, and so forth.

When I tried doing just
mysql -u myusername -p
I get the error:
Access denied for user 'username'@'localhost' (using password: YES)

April 22nd, 2008, 07:05 PM
again, username = root

not your username, not the root of the system, is the root on the mysql, the first account created by default on install.


mysql -u root -p
password: <invisible characters>

April 22nd, 2008, 11:33 PM
Thanks a lot Can+~. It works perfectly now.