Portal Home > Knowledgebase > Articles Database > Mysqldump question to make backup
Mysqldump question to make backup
Posted by hbhb, 12-30-2009, 12:15 AM |
Hi,
I am trying to make a backup on a CentOS server (with no control panel or whatsoever) on a database name called "technogh"
[root@app1 backup]# mysqldump technogh > /backup/db/technogh.sql
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
What is the correct method?
|
Posted by Chris Isaac, 12-30-2009, 12:38 AM |
Hi,
Try this:
mysqldump -u root -p technogh > technogh.sql
and provide mysql root password when prompted.
|
Posted by prakashck, 12-30-2009, 12:46 AM |
I have a fix but just to know whether you try to do it with out password or with password.
if with out password we can edit my.cnf file with username and password. Please check
http://dev.mysql.com/doc/refman/5.1/...ion-files.html
If with password please grant privilege for root@localhost
|
Posted by hbhb, 12-30-2009, 02:08 AM |
uroot -p{rootpassword} works! thanks!
----close----
|
Posted by jalapeno55, 12-30-2009, 10:39 AM |
Instead of /etc/my.cnf, you should use this:
~/.my.cnf User-specific options
Ex. put it in /root/.my.cnf
|
Posted by fwaggle, 12-30-2009, 12:14 PM |
Yup, unless you don't care if everyone on the machine can connect to that database user. I definitely wouldn't use the root user for that either - I'd make a backup user that only has the privileges necessary for dumping (I think it's select and lock, but it's been a while) and then connect as that user for backup purposes.
Don't put the password on the command line - it'll show up in various places that you probably don't want it to. If you leave the password off the commandline and just do -p it'll prompt you.
If you're wanting to automate it, use ~/.my.cnf.
|
Posted by jalapeno55, 12-30-2009, 04:20 PM |
That is not true. It would only allow root.
|
Add to Favourites Print this Article
Also Read