Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

1) I have installed mysql server and mysql client through apt-get install mysql-server and apt-get install mysql-client

2) when I run sudo netstat -tap | grep mysql, I see following:

tcp        0      0 localhost:mysql         *:*                     LISTEN      15138/mysqld

I think it is running

3) now I go to usr/share/mysql and type: show databases; it shows me following,

The program 'show' is currently not installed.  You can install it by typing:
apt-get install nmh

Can anybody please tell me what is the problem ? Am I running command from wrong directory ?

Thanks,

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You first need to login to your mysql account by this command:

mysql -u <username> -p

<username> should be replaced by your username. Then it will ask you for your password. Enter you password and run this command :

show databases;

It will be better if you also install :

sudo apt-get install mysql-common
share|improve this answer
    
Thanks Pranit ! it worked ! –  richa Aug 17 '12 at 14:48
    
welcome! the thing you tried before would just show the active connections! Its no where related to the databases that you have. And to enter mysql commands, you have to always login. Otherwise it is not possible to do anything in mysql! –  Pranit Bauva Aug 17 '12 at 14:51
2  
Duplicate answers adding little information are generally frowned-upon bu the community. –  hexafraction Aug 17 '12 at 14:58
    
@ObsessiveFOSS I explained the commands (step by step) rather than just giving what to do. –  Pranit Bauva Aug 17 '12 at 15:00
2  
The note about installing mysql-common being "better" is a little subjective. Why is it better? What exactly, will mysql-common do for this user? –  BryceAtNetwork23 Aug 17 '12 at 15:08
show 5 more comments

That's because you're trying to enter SQL commands from the Ubuntu command line. You need to enter them from the MySQL command line:

$ mysql -h localhost -u user -p password

mysql> show databases;   
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.