LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mysqladmin: connect to server at 'localhost' failed(Confusion abot MySQL and mysqladm (https://www.linuxquestions.org/questions/linux-server-73/mysqladmin-connect-to-server-at-localhost-failed-confusion-abot-mysql-and-mysqladm-794392/)

Terry56 03-10-2010 03:02 AM

mysqladmin: connect to server at 'localhost' failed(Confusion abot MySQL and mysqladm
 
Hi,
Hope you all are at good health:).I have some confusion about mysqladmin and mysql.I am using mysql version
Quote:

[root@localhost freepbx-2.7.0]# mysql --version
mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using readline 5.1
My MySQL is running
Quote:

[root@localhost freepbx-2.7.0]# /etc/init.d/mysqld status
mysqld (pid 11440) is running...
I have a root account named root and i am easily connect with it.When i try to execute command. I get the following error

Quote:

[root@localhost freepbx-2.7.0]# mysqladmin create asterisk
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
If i connect to mysql root account by mysql -u root -p and after that if i execute command then i get this

Quote:

[root@localhost freepbx-2.7.0]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> mysqladmin create asterisk
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin create asterisk' at line 1
mysql> mysqladmin create asterisk;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin create asterisk' at line 1
mysql>
I want to ask why this command is not working
Quote:

[root@localhost freepbx-2.7.0]# mysqladmin create asterisk
Do i suppose to start mysqladmin like i start mysql(/etc/init.d/mysqladmin start or something like this)
I am using
Quote:

[root@localhost freepbx-2.7.0]# mysqladmin --version
mysqladmin Ver 8.41 Distrib 5.0.77, for redhat-linux-gnu on i686
Also in mysqladmin create asterisk. Is asterisk is a username or database name?
Thanks you.

freelinuxtutorials 03-10-2010 03:28 AM

you need to add username and password,
something like
Quote:

mysqladmin -u root -p create asterisk

Terry56 03-10-2010 03:37 AM

Hi,
Thanks.:eek:Hmmm. Ok But i want to ask another thing :scratch: Is mysql and mysqladmin are two different things? Means do both have their own users? The user created on mysql is different and user created on mysqladmin is different.

Thanks

freelinuxtutorials 03-10-2010 04:39 AM

If you have the same server communicating to, of course ,they have the same users. mysql and mysqladmin are just tools. basically mysqladmin from the word itself, is a client for administering the mysql server. mysqladmin is used normally to execute mysql commands in the CLI,not in the mysql prompt.This is very useful when creating shell scripts

I'll give you an example
objective: to show processlist
using mysql
1. #mysql -uroot -ppassword
mysql>show processlist;

using mysqladmin
# mysqladmin -u root -ppassword processlist

They will basically do the same thing

arashi256 03-10-2010 07:20 AM

"mysqladmin" is a command-line tool to enable certain administrative tasks on the MySQL server running on that machine. "mysql" is the command-line *client* which allows you to login to the MySQL server (which may or may not be on the same machine) to perform whatever tasks you want.


All times are GMT -5. The time now is 05:01 PM.