By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

I just ran /usr/bin/mysql_install_db and it told me to set a password for the MySQL root USER. I cannot.

P: n/a
MLH
I'm supposed to set a password for the MySQL root user. The output of
mysql_install_db instructed me to run the following commands...
/usr/bin/mysqladmin -u root -h appserver password mynwewpasswd
I did. It did not work. Here's the error:
/usr/bin/mysqladmin: connect to server at 'appserver' failed
error: 'Host 'appserver.crci.com' is not allowed to connect to this
MySQL server'

Another command I'm supposed to run also resulted in an error. Here
is the command and the ensuing error...
/usr/bin/mysqladmin -u root password mynewpassword
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

Can anyone tell me why I am getting these error messages and how
I can successfully set a password for the MySQL root user?

xxxxxxxxxxxxxxxxx mysql_install_db screen output xxxxxxxxxxxxxxxxxxx
Here's text of /usr/bin/mysql_install_db output to screen...

Installing all prepared tables

To start mysqld at boot time you have to copy
support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/etc/init.d/mysql start (you have to start the server first!)
/usr/bin/mysqladmin -u root -h appserver password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench'
directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
MLH wrote:
/usr/bin/mysqladmin -u root -h appserver password mynwewpasswd
I did. It did not work. Here's the error:
/usr/bin/mysqladmin: connect to server at 'appserver' failed
error: 'Host 'appserver.crci.com' is not allowed to connect to this
MySQL server'
This depends on the privileges set up for MySQL on that host. It's
certainly possible that it's configured to deny _any_ account from
connecting from another host. Or it could be that it's configured to
deny root when you don't supply a password.

The "-u root" without an accompanying "-p" means "I want to connect as
root, without giving a password." It's not unusual for people to
configure MySQL to disallow this.

The requirement to specify the "-p" option is there because MySQL also
allows you to configure accounts so that they _can_ connect without
requiring the password. You could even configure one account such that
if you don't specify a password, you get some limited privileges, but if
you do specify a password for the same account, you get a different set
of privileges! So there has to be a way to run the mysql commands both
with and without specifying a password. IMHO, the syntax they've chosen
to implement this feature isn't necessarily the most clear in
retrospect, but there might have been some historical reason for them to
do it the way they did.
/usr/bin/mysqladmin -u root password mynewpassword
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'


This means that you tried to connect as root to set root's password, but
you specified no password. MySQL seems to want root's current
password before it'll let you do that.

Sounds like you should contact the person who sold you this server, and
ask what is the current MySQL root password.

Regards,
Bill K.
Jul 23 '05 #2

P: n/a
MLH
On Sun, 27 Mar 2005 20:06:13 -0800, Bill Karwin <bi**@karwin.com>
wrote:
MLH wrote:
/usr/bin/mysqladmin -u root -h appserver password mynwewpasswd
I did. It did not work. Here's the error:
/usr/bin/mysqladmin: connect to server at 'appserver' failed
error: 'Host 'appserver.crci.com' is not allowed to connect to this
MySQL server'


This depends on the privileges set up for MySQL on that host. It's
certainly possible that it's configured to deny _any_ account from
connecting from another host. Or it could be that it's configured to
deny root when you don't supply a password.

The "-u root" without an accompanying "-p" means "I want to connect as
root, without giving a password." It's not unusual for people to
configure MySQL to disallow this.

The requirement to specify the "-p" option is there because MySQL also
allows you to configure accounts so that they _can_ connect without
requiring the password. You could even configure one account such that
if you don't specify a password, you get some limited privileges, but if
you do specify a password for the same account, you get a different set
of privileges! So there has to be a way to run the mysql commands both
with and without specifying a password. IMHO, the syntax they've chosen
to implement this feature isn't necessarily the most clear in
retrospect, but there might have been some historical reason for them to
do it the way they did.
/usr/bin/mysqladmin -u root password mynewpassword
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'


This means that you tried to connect as root to set root's password, but
you specified no password. MySQL seems to want root's current
password before it'll let you do that.

Sounds like you should contact the person who sold you this server, and
ask what is the current MySQL root password.

Regards,
Bill K.


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx
Thank-you very much, Bill. You are a genius. Everything you
said was right. I contacted the guy & he gave me the password.
I am successfully logging in now, on my way to completing the
objective of running source on the dump file, I'm sure. Here's
some screen capture showing you what I've successfully been
able to accomplish...

Script started on Mon Mar 28 13:16:04 2005
mlh@appserver mlh $ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.0.22

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

mysql> select user();
+---------------+
| user() |
+---------------+
| mlh@localhost|
+---------------+
1 row in set (0.00 sec)

mysql> quit
Bye
mlh@appserver mlh $ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.0.22

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

mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost|
+----------------+
1 row in set (0.00 sec)

mysql> quit
Bye
mlh@appserver mlh $ su dewey
Password:
dewey@appserver mlh $ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 4.0.22

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

mysql> select user();
+-----------------+
| user() |
+-----------------+
| dewey@localhost |
+-----------------+
1 row in set (0.00 sec)

mysql> quit
Bye
dewey@appserver mlh $ exit
exit
mlh@appserver mlh $ exit

Script done on Mon Mar 28 13:24:24 2005

==> I am slightly confused about the return values from
the two ANONYMOUS logins shown above. I would have
expected the USER( ) function to return a name like
anonymous@localhost instead of mlh or dewey at localhost.
Is that considered normal?
Jul 23 '05 #3

P: n/a
MLH wrote:
==> I am slightly confused about the return values from
the two ANONYMOUS logins shown above. I would have
expected the USER( ) function to return a name like
anonymous@localhost instead of mlh or dewey at localhost.
Is that considered normal?


On Linux, yes. The "anonymous" login functionality allows you to
connect without providing a password. MySQL detects your username as
your Linux login, and the USER() function returns that string. MySQL
"trusts" that you have been authenticated by the operating system if you
got far enough to run the 'mysql' command.

This isn't very reliable or secure by many people's standards, though.
So for servers where security is considered important, one can disable
anonymous logins on their MySQL installations.
Read http://dev.mysql.com/doc/mysql/en/de...rivileges.html for more
information on that topic.

Regards,
Bill K.
Jul 23 '05 #4

P: n/a
Bill Karwin wrote:
On Linux, yes. The "anonymous" login functionality allows you to
connect without providing a password.


That's wrong. The anonymous login is not _necessarily_ passwordless,
though that is the configuration that ships with the product.

Sorry for the misinformation,
Bill K.
Jul 23 '05 #5

P: n/a
MLH
Misinformation that's now corrected. Who am I to complain?
Thx for helping out In another thread, I'm addressing the issue
of trying to telnet to the linux box over port 3306 (just to ensure
that port 3306 is really workikng for me). ... until my linux server
will respond to a command like
this: telnet 192.168.1.106 3306
I haven't got a snowball's chance of attaching to my mysql
tables on that same linux server, right? I'm afraid I don't know
how to configure the linux box to allow that, but that's a subject
for another news group. Let me see what I can find out and I'll
revisit this topic with this group after I can telnet in over port
3306. Thx.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx

On Thu, 31 Mar 2005 10:00:36 -0800, Bill Karwin <bi**@karwin.com>
wrote:
Bill Karwin wrote:
On Linux, yes. The "anonymous" login functionality allows you to
connect without providing a password.


That's wrong. The anonymous login is not _necessarily_ passwordless,
though that is the configuration that ships with the product.

Sorry for the misinformation,
Bill K.


Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.