473,471 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Database Dump with PHP

Hi,

I want to dump out a database to the screen using mysqldump, like so...

<?php
echo system('mysqldump -h localhost -u user -p password
my_database');
?>

However, it won't accept my password being passed in like this. Is this
a mysql configuration problem?

Normally, if I were to do this in a terminal window, I would type:
'mysqldump -u user -p my_database', it would then prompt me for my
password before performing the operation.

Any suggestions on how this can be done?

TIA.

Noodle

Sep 8 '06 #1
3 7729

Noodle napisal(a):
Hi,

I want to dump out a database to the screen using mysqldump, like so...

<?php
echo system('mysqldump -h localhost -u user -p password
my_database');
?>

However, it won't accept my password being passed in like this. Is this
a mysql configuration problem?
No, just take a look at mysqldump manpage. There is no option for
password, beucause of security reasons. If it was possible, everyone
would see your password by typing just: $ps -aux.

Maybe try to open pipe to mysqldump proccess and then put password into
it. (php.net/popen)

Sep 8 '06 #2
"There is no option for password, beucause of security reasons"
Wrong, I have an automated backup script (powered by PHP) and it uses
the mysqldump terminal command and you can specify password (because I
do). The poster above you was correct (the poster called NC).
Mateusz Markowski wrote:
Noodle napisal(a):
Hi,

I want to dump out a database to the screen using mysqldump, like so...

<?php
echo system('mysqldump -h localhost -u user -p password
my_database');
?>

However, it won't accept my password being passed in like this. Is this
a mysql configuration problem?

No, just take a look at mysqldump manpage. There is no option for
password, beucause of security reasons. If it was possible, everyone
would see your password by typing just: $ps -aux.

Maybe try to open pipe to mysqldump proccess and then put password into
it. (php.net/popen)
Sep 8 '06 #3

NC wrote:
Noodle wrote:

I want to dump out a database to the screen using
mysqldump, like so...

<?php
echo system('mysqldump -h localhost -u user
-p password my_database');
?>

However, it won't accept my password being passed
in like this. Is this a mysql configuration problem?

No, it's your not having read the MySQL Manual. When you enter
password on the command line, there should not be any whitespace
between -p and password:

mysqldump -h localhost -u user -ppassword my_database

Cheers,
NC
Thanks NC, this has fixed the password problem.

Sep 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dave Moore | last post by:
Hi All, I'm looking at using PHP and MySQL for a particular website application. However, I was a bit concerned that if a PHP script went wrong then it would be possible to accidentally delete or...
1
by: Rajesh Kumar Mallah | last post by:
Hi , my current database in 7.3.4 is SQL_ASCII are there any benifits of coverting it to UNICODE encoding in 7.4 ? If so what is the process. Regds Mallah.
1
by: Ruth Hsieh | last post by:
The postgreSQL release used is 7.3.4. We would like to dump the objects for particular user. How? I used -U option, the result still dump all the objects with all the users. In order to...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
6
by: brian.j.parker | last post by:
I inherited an application (or two) that run on SQL Server 6.5, which I haven't used in years, and am having a problem. I get the error: ...
0
by: Hans | last post by:
Hi, That's my first time to send mail to this address for asking help. Sorry for my poor english firstly. My case is like this: Many guys are using a mysql database, each guy has a database...
2
by: Scott Jones | last post by:
Hello, In an attempt to save disk space, I went in and gzipped all of the log files for my database running DB2 version 7.2 . This resulted in the database being marked bad because a log file...
0
by: A3AN | last post by:
Hi. I receive a database backup on a daily basis. I then import this dump on another server which I use for software development. There is two db's being hosted on this server. We test software...
8
by: Abandoned | last post by:
Hi. I want to copy my database but python give me error when i use this command. cursor.execute("pg_dump mydata old.dump") What is the problem ? And how can i copy the database with python ?...
3
by: pechar | last post by:
Hi all, I am planning to create a windows application, which is meant to retrieve the sql dump of a mysql database. What I need is the structure and the data as well. You might ask why create...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.