473,553 Members | 3,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems with FILE priv granting

I've a PHP script that is supposed to write results to a file using
INTO OUTFILE, but it's not.

The mysql_error says: Could not write file: Can't create/write to file
'/var/www/html/accounts/samplesdownload/1136572640.txt' (Errcode: 2)

The permissions on that folder has "a+w -R" chmoded to it, and in fact,
other scripts can write to it, but not from a SQL querey.

So looking to mySQL I look at the privileges for the user account being
used for that database.
And the mysql.db table, the user has Y for all privileges, but there's
no column for the FILE privilege!

So I grant the user global FILE privilege and flush, and still no
change in the error.

Any feedback as to what direction to go with this would be greatly
appreciated!
-Liam

Jan 6 '06 #1
5 6999
Hi,

IIRC, the SELECT ... INTO OUTFILE command can't write to a file, if the file
already exists. So make sure that you delete an existing file (e.g. with the
PHP unlink() command) before you create a new one.

Markus
Jan 6 '06 #2

Markus Popp wrote:
Hi,

IIRC, the SELECT ... INTO OUTFILE command can't write to a file, if the file
already exists. So make sure that you delete an existing file (e.g. with the
PHP unlink() command) before you create a new one.

Markus


Good tip!
Except in this case the name of the file is a unix timestamp, so it's
always unique. =)
Thanks for the reply!
-Liam

Jan 6 '06 #3

ne**@celticbear .com wrote:
I've a PHP script that is supposed to write results to a file using
INTO OUTFILE, but it's not.

The mysql_error says: Could not write file: Can't create/write to file
'/var/www/html/accounts/samplesdownload/1136572640.txt' (Errcode: 2)

The permissions on that folder has "a+w -R" chmoded to it, and in fact,
other scripts can write to it, but not from a SQL querey.

So looking to mySQL I look at the privileges for the user account being
used for that database.
And the mysql.db table, the user has Y for all privileges, but there's
no column for the FILE privilege!

So I grant the user global FILE privilege and flush, and still no
change in the error.

Any feedback as to what direction to go with this would be greatly
appreciated!
-Liam


Oh yeah, forgot to mention.
I also tried:

mysql> GRANT FILE ON printing.* TO 'usernamet'@'se rvername';
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

Guess the fact there's no File column on the db table would explain why
that failed. =/

-Liam

Jan 6 '06 #4
The FILE privilege can only be granted on the user level - that's alright.
If the user has FILE privileges (you can check it with SHOW GRANTS) and you
have write privileges in the directory you want to write to (you can check
it with the 'ls -l' command) and the file you want to create doesn't exist,
then it has to work.

Take care that the SELECT ... INTO OUTFILE command writes to the file system
of the database server, so if you have a remote MySQL server, it will write
the data to the remote file system, not to your local one.

These are all conditions that should apply to using this command, but if it
still doesn't work, I cannot do more than to refer you to

http://dev.mysql.com/doc/refman/5.0/en/privileges.html

http://dev.mysql.com/doc/refman/5.0/en/select.html

and if it still doesn't work, to file a bug report.

Markus
Jan 7 '06 #5

Markus Popp wrote:
[..]
Take care that the SELECT ... INTO OUTFILE command writes to the file system
of the database server, so if you have a remote MySQL server, it will write
the data to the remote file system, not to your local one.

[..]

Oh! That's the problem. The mySQL server IS a remote server.
I'll have to OUTFILE to that server and then scp it over to the Web
server I guess.
Thanks for the reply!
-Liam

Jan 9 '06 #6

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

Similar topics

1
1873
by: Stephajn Craig | last post by:
It's been a while since I posted here, but here goes. Our server is a Windows 2000 Server with Service Pack 3, IIS 5 with Lockdown Wizard applied. My first problem is related to CDONTS.NewMail. Up until recently, I had no problems sending e-mail with this little utility. Our current development efforts are moving to .NET so it didn't...
0
2657
by: Colin Steadman | last post by:
I'm trying to setup a small ASP app that our Accounts department can use to kick off database procedures through a browser. To do this I need the ASP page to kick off a preprepared .VBS script file. I've made some good progress on this, but have hit a brick wall and dont know where to go next. I have setup a basic HTML form which submits...
2
8551
by: Ted | last post by:
How do I grant all privileges for a schema that has a large number of existing tables, procedures, functions, etc to a newly created role, without having to issue a grant statement for each object and each privilege? I want the role to have all of the rights of the schema owner. Is there any kind of blanket granting of all privileges to a...
3
417
by: Tim Werth | last post by:
I have a Windows Service that is running as an administrator account. Some of it methods create files for a COM+ client to digest and puts them in C:\Documents and Settings\All Users\Application Data\... The file is created with a StreamWriter. When the COM+ client (running as a non-admin user) is finished with the file, it tries to clean...
1
1966
by: Jesper | last post by:
Im running Windows Server 2003 trying to get my ASP.NET applications to access the file system. My Web application needs to have write access to some folders in the virtual directory from which it runs. The server is a domain controller, so I don't have the ASPNET user to assign rights to. I've tried several guides from several sites.....
2
1339
by: Trint Smith | last post by:
I need to store an entire html file in a string and not call it from a file. Is that possible?? How can I do this?? with rows double quotes and all...It needs to be something like this: Dim file As String = "<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"...
2
1462
by: Edd | last post by:
Hello all, Please consider: class Base { public: int pub; protected: int prot; private: int priv; };
0
1560
by: Roland Riess | last post by:
Hi, as an absolute web and configuration beginner I am stuck with a problem and so I finally seek your help again: Development tools: ASP.NET 1.1, C#, VS 2003, Windows 2000 SP4, IIS 5.0 I developped a web service that writes data from a text file uploaded from a Pocket PC to a database, and then prepares another text file with updated...
11
2873
by: =?Utf-8?B?c2NodXJzdDMw?= | last post by:
Hi, I am currently trying to get back into ASP and have begun looking at an old webpage I developed some years ago, it was fully functional back in 2002 and I had it up and running with no problems. I have just recently bought a new PC with Windows Vista Home Premium on it and installed IIS. When I try and connect to my data base I get the...
0
7772
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7526
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7852
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6109
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1990
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1106
muto222
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.