Confused maybe about MySQL Dump & PHP


 
Thread Tools Search this Thread
Top Forums Web Development Confused maybe about MySQL Dump & PHP
# 8  
Old 06-03-2009
Quote:
i'm guessing that means I can't run things properly? (I'm not sure, I obviously had a shell to output a file with and everything... I just wasn't successful in outputting a GOOD file)
Redirect stderr from mysqldump as well. Use &> instead of just >
# 9  
Old 06-03-2009
Quote:
Originally Posted by otheus
Redirect stderr from mysqldump as well. Use &> instead of just >
Thanks! I did just that, and got the following error (which, allow me to preface, I've been having similar errors trying to make a small test site on my server of Drupal)

Code:
Enter password: mysqldump: Got error: 1045: Access denied for user 'jzacsh_jzacsh'@'localhost' (using password: NO) when trying to connect

But I don't understand - I'm using the same username/password and database as my wordpress install, I even copy/pasted the syntax of it out of the wp-config.php file, so I don't know what I'm mistyping
# 10  
Old 06-03-2009
Isn''t that curious... with mysqldump, you have to specify --password, not -p.

mysqldump -u jzacsh_jzacsh --password=wordpres --single-transaction jzacsh_jzwp
# 11  
Old 06-03-2009
Question

Quote:
Originally Posted by otheus
Isn''t that curious... with mysqldump, you have to specify --password, not -p.

mysqldump -u jzacsh_jzacsh --password=wordpres --single-transaction jzacsh_jzwp

aah! thank you. okay, this is now what I get:
Code:
mysqldump: Got error: 1044: Access denied for user 'jzacsh_jzacsh'@'localhost' to database 'jzwp' when selecting the database
-- MySQL dump 10.11
--
-- Host: localhost    Database: jzwp
-- ------------------------------------------------------
-- Server version	5.0.81-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

any suggestions? how is it possible I'm still getting an access error at the beginning of the output, if I clearly have some kind of interaction going on below??
# 12  
Old 06-03-2009
Could it be you are selecting the wrong database? Maybe internal to MySQL it is simply 'jzwp' and not 'jzacsh_jzwp' ? So the login works and you have access to your own database. But you can't switch to a non-existent database, so you get the error. But because you successfully logged in, you get the database dump as normal.
# 13  
Old 06-04-2009
Bug

Quote:
Originally Posted by otheus
Could it be you are selecting the wrong database? Maybe internal to MySQL it is simply 'jzwp' and not 'jzacsh_jzwp' ? So the login works and you have access to your own database. But you can't switch to a non-existent database, so you get the error. But because you successfully logged in, you get the database dump as normal.
wow that's amazing! (I had been trying that previously, when I had the --password syntax incorrect). Thank you so much for sticking around! I'll be finishing a book soon on PHP & MySQL and a 2-part unix admin course... you can be sure I'll be around to support these forums!

ps.
so that others can benefit, here's what the final proper output looks like for me:

Code:
mysqldump -u uname --password=psswd --single-transaction prefix_dbname | dd bs=1M | gzip -c > $sql_Path 2>&1


Last edited by jzacsh; 06-04-2009 at 12:52 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create mysql database with bash script - confused

Hi, i have the following: db="create database xxx;GRANT ALL PRIVILEGES ON xxx.* TO user@localhost IDENTIFIED BY 'password';FLUSH PRIVILEGES;quit;" mysql -u root -p$mysql_pass -e "$db" I don't understand why this is failing, it works fine when run from cmd but when is run in a bash script,... (1 Reply)
Discussion started by: ktm
1 Replies

2. Shell Programming and Scripting

Can't add variable to file name in mySQL dump script

I have a script (below) which works ok, but I have tried to modify it as I want to keep the older files for a restore if needed. I have tried adding a date suffix to the newly created files (second lump of code), but it doesn't seem to work. I get the error: $SOURCEDIR/p1db_$DATEVAR.sql:... (3 Replies)
Discussion started by: ojobson
3 Replies

3. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

4. Web Development

[php] webpage with login & mysql-db

Hi all, What I was looking for before was a multi-user password manager, web-based! The offer of free or cheap tools of this kind is very pover. Or they are too complex (or too expensive) I'm not a web programmer but I now decided to set up a (php) website with login and based on this login... (1 Reply)
Discussion started by: thibautp
1 Replies

5. Shell Programming and Scripting

how to break mysql dump sql file

Hi folks I have mysql dump which having insert queries, i want to break that file when 10 complete "INSERTS" lines so extract that line and store in 1.sql and 2.sql and for next 10 insert lines. pls guide me how can i do that. Regards, Bash (2 Replies)
Discussion started by: learnbash
2 Replies

6. Shell Programming and Scripting

restore mysql dump file in many remote servers?

Hi all, I want to restore DB file in many mysql servers, i already using script for sending the dumpfile in all servers, but it's just annoying if i have to restore the dumpfile in all servers, i want just execute 1 script, and will restore in all remote mysql servers. I make script but not... (2 Replies)
Discussion started by: blesets
2 Replies

7. Shell Programming and Scripting

PHP & MySQL: sort desending and print

How do i get php to sort the times in a table and print order desending. eg: in the table i have: 02:60.00 02:70.00 02:20.00 02:50.00 in that order in a table how do i get php & mysql to print... (1 Reply)
Discussion started by: perleo
1 Replies

8. UNIX for Dummies Questions & Answers

PHP & Apache & MySQL install how-to ?

how do i install php & mysql with apache on suse linux ??? apache was installed and configured when i installed linux. all its files are in different folders. e.g http files in usr/local/httpd/htdocs/ and its configs are in etc/httpd/ so how do i install php and get it to work with apache and... (4 Replies)
Discussion started by: perleo
4 Replies

9. UNIX for Dummies Questions & Answers

Linux/Unix/PHP/MySQL & servers?

Hello everyone! First I would like to say that I am very glad that I found this forum, and by some of the posts I have viewed, I see that I can learn a lot from you all! Secondly, I know next to nothing about Linux/Unix (gotta learn sometime right?) and need some assistance. I am a... (5 Replies)
Discussion started by: kolton
5 Replies
Login or Register to Ask a Question