473,657 Members | 2,585 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 7007
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
1876
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 matter to us that this is something that won't be supported anymore by MS. However, while we are in...
0
2662
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 a request to an ASP page. The ASP page creates a WSCRIPT shell on the server and runs the...
2
8561
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 role?
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 it up but gets a Permission denied error. How can the service programmatically grant delete...
1
1972
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.. but none seem to work, I keep getting the: "..Access to the path "..." is denied.
2
1342
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" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:b="urn:schemas-microsoft-com:office:publisher"...
2
1470
by: Edd | last post by:
Hello all, Please consider: class Base { public: int pub; protected: int prot; private: int priv; };
0
1576
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 master data for download by the Pocket PC.
11
2879
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 following error message retunred: Microsoft OLE DB Provider for ODBC Drivers error '80004005' ...
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
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
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.