mysqldump Pbm

Hello,

I use a script to backups all my mysql databases.
I’ve created a .my.cnf in /root/ to allow cron to run mysqldump

here is the .my.cnf

[mysqladmin]
user = root
password = <myrootpassword>

Then basicly I run :

mysqldump -u=root --all-databases > all-databases.sql

I have few pbms.

If I only do under root:

mysqldump --all-databases > all-databases.sql
or
mysqldump -u root --all-databases > all-databases.sql

I have this message :

mysqldump: Got error: 1045: Access denied for user: ‘root@localhost’ (Using password: NO) when trying to connect

but if I do

mysqldump -u=root --all-databases > all-databases.sql

it doesn’t complaint and create all-databases but I have nothing in all-databases.sql, only the header

– MySQL dump 9.11

– Host: localhost Database:


– Server version 4.0.21-standard

Any idea ?

Thanks
Pascal

-u=root is incorrect and mysqldump apparently ignores it. You need to do:

mysqldump -u root -p --all-databases > all.sql

the ‘-p’ will cause mysqldump to prompt for the mysql root pw, and that’s what you need to get past the access denied msg.

Chris

hi Chris

I know this, but in fact, I’ve tried a lot of kind things to try have it working.

if I do mysql -u=root
it works, which means it reads the /root/.my.cnf password, right ?

As I’ve created a .my.cnf in /root/ and as I do these with user root, it should work only with
mysql or mysqldump or mysql -u root

but it doesn’t

My problem is I have a cron job that does a mysqldump and I’d like it use the /root/.my.cnf to find the root password. I assume it should work like this, ins’t it ?

If I do in a script
mysqldump -u root -p --all-databes > alldatabases.sql

it works but ask me for the rtoot password, if i launch in cron it stops

So how to give the password to this script, I thought the /root/.my.cnf was for this

Thanks

Ok I found the problem.

in /root/.my.cnf if change the line [mysqladmin] to the line [client]

and now it works fine

Cooool

thanks
Pascal

I’ve been having a similar problem and am unable to resolve it.

I am trying to run a query to give a db user permission on a certain database. (GRANT command)

The Grant statement which I am issuing is in the following format:
GRANT ALL PRIVILEGES ON db_name TO ‘user’@‘ip’ IDENTIFIED BY ‘pass’

However, when I run the query in PHPMyAdmin, I continue to get the error:

MySQL said: Documentation
#1044 - Access denied for user ‘domainna’@‘localhost’ to database ‘db_name’

The “domainna” above is actually the first 8 characters of my hostname (domain name). I don’t like that InterWorx pads all usernames with the name of the domain first… I feel that this is causing the issue.

Anyways I’ve been told that I need to perform this query as root while shelled into my server.

I’ve been told to shell in and then issue:

mysql -uroot -prootpass

However, I never set a MySQL root password. Is one set automatically? Is there a way for me to set one?

Any help would be appreciated.

Thanks!

Hi Int,

Is there any reason why you aren’t using SiteWorx to grant this user permissions? Regardless, ‘domainna’ is not a valid database user created by SiteWorx. All database users created from siteworx are of the form ‘domainna_username’. So, you’d want to use something like:

GRANT ALL PRIVILEGES ON db_name TO ‘testdoma_testuser’@‘ip’ IDENTIFIED BY ‘pass’

You can reset the MySQL root pass from NodeWorx by going to System Services -> MySQL Server -> Overview, and look for the MySQL Root Password box at the bottom of the screen.

Socheat