After running my PHP/MySQL application, I have found that the
associated .MYD and .MYI files remain locked. Even after the browser
is closed, if I try to rename these files, I get the message:
Can't rename filename. It is being used by another person or
program...
These files remain locked until I reboot. I'm running on a Windows XP
machine.
Here is a code snippet that locks the two files:
<?php
//Connect to server and database
$host="localhos t";
$user="root";
$password="";
$edenconnect = mysql_connect($ host,$user,$pas sword)
or die("Could not connect to server.");
mysql_select_db ("eden")
or die("Could not connect to database.");
$sql = "SELECT * FROM edenmaster";
$result = mysql_query($sq l);
$row = mysql_fetch_arr ay($result);
mysql_free_resu lt($result);
mysql_close(); // Also tried mysql_close($ed enconnect);
exit;
?>
After running this snippet and closing the browser, files
edenmaster.myd and edenmaster.myi are locked to renaming until a
reboot.
I thought the mysql_close() would free the files, but it does not.
Any ideas?
Thanks! 4 1788
On 7 Sep 2005 12:30:09 -0700, hi***********@y ahoo.com wrote: After running my PHP/MySQL application, I have found that the associated .MYD and .MYI files remain locked. Even after the browser is closed, if I try to rename these files, I get the message:
Can't rename filename. It is being used by another person or program...
These files remain locked until I reboot. I'm running on a Windows XP machine.
After running this snippet and closing the browser, files edenmaster.m yd and edenmaster.myi are locked to renaming until a reboot.
I thought the mysql_close() would free the files, but it does not.
Why are you expecting the files to be unlocked?
The MySQL server daemon will have them open, and there's no reason for it to
close the files whilst it's running.
Why are you renaming the files via the filesystem? To rename a table you use
the RENAME SQL command.
--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Andy Hassall wrote: Why are you expecting the files to be unlocked?
I assumed when the application closed the database, the files would be
released.
The MySQL server daemon will have them open, and there's no reason for it to close the files whilst it's running.
Even after closing MySQL and the Apache server, the files are still
locked.
Why are you renaming the files via the filesystem? To rename a table you use the RENAME SQL command.
I bumped into this by accident. I'm not concerned about renaming them,
just the fact that the connection still seems to be open.
Thanks!
-- Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
On 7 Sep 2005 12:56:51 -0700, hi***********@y ahoo.com wrote: Andy Hassall wrote:
Why are you expecting the files to be unlocked?
I assumed when the application closed the database, the files would be released.
The application only sees the view of the database that the MySQL daemon
offers it, through SQL. The files are an implementation detail handled by the
daemon itself; the client application can't open or close them. The MySQL server daemon will have them open, and there's no reason for it to close the files whilst it's running.
Even after closing MySQL and the Apache server, the files are still locked.
After closing MySQL? As in stopping the MySQL daemon? That would be more
unusual - only MySQL itself has any business accessing those files, so if you
stop the MySQL service completely then nothing else should have them open.
Could you expand on what you mean by "closing MySQL"?
You can find what has files open with a tool like Process Explorer
( http://www.sysinternals.com/Utilitie...sExplorer.html) Why are you renaming the files via the filesystem? To rename a table you use the RENAME SQL command. I bumped into this by accident. I'm not concerned about renaming them, just the fact that the connection still seems to be open.
PHP will have closed its connection, as you were using mysql_connect rather
than mysql_pconnect (which does persistent connections).
That doesn't have any implication that the MySQL daemon will close files in
response - there's no particular reason it should, it'd only have to open them
again later.
--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Andy Hassall wrote: On 7 Sep 2005 12:56:51 -0700, hi***********@y ahoo.com wrote:
Could you expand on what you mean by "closing MySQL"?
I am running the Apache Friends implementation of PHP and MySQL. They
provide .bat files to start the two services which then stay resident.
I have been closing/stopping them by closing their Windows program
boxes. It looks like that does close Apache, but MySQL still appears
as a running process.
Just tried closing the MySQL process, and now the files are freed up.
Thanks for getting me on the right track! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: disco |
last post by:
I am working on this example from a book "C Primer Plus" by Prata 4th
edition - p. 672. There is no erata on this problem at the publisher's
website.
1) Is it a violation of copyright laws to post example code from a
book to a newsgroup?
2) The program crashes as it tries to free memory and I would like to
know the best way to correct THIS section of the code. By assigning
current = head, current now points to the first structure in...
|
by: Rodrigo Dominguez |
last post by:
there are sometimes that I use third party libraries, I use some functions
that returns char * or structs, etc. sometimes the memory that is returned
by those libraries, when I try to free this memory whith the function free,
it brokes my application, and sometimes it's ok, why? how do I realize when
I have to free the memory that is allocated by third party libraries and
why sometimes I don't have to free this memory?
Thank you
|
by: Fernando Cacciola |
last post by:
Help me out here please:
While watching Brad Abraham's MSDN TV talk about the Dispose pattern,
refering to:
public virtual void Dispose ( bool disposing )
{
if ( disposing )
{
<-- WHAT GOES HERE -->
|
by: Atul Sureka |
last post by:
Hi,
I want to free the object memory in C# - like we do using 'delete' keyword
in C++.
Lets say I have an object of some class and I want to explicitly free the
memory.
C# do not have any free or delete keyword to do so.
Also I don't want to wait for the GC to be called.
|
by: Amogh |
last post by:
Hi,
My question is related to setting freed pointers to NULL.
After freeing a pointer:
1) Should the freeing routine also be responsible for setting the
pointer to null?
2) Or, should the client/user code be responsible for doing it?
On what basis should a decision be made favouring either case ?
| |
by: billq |
last post by:
Hello,
I am new to c# and have become confused about freeing resources. I need to
know if using an objects Dispose method does the same thing as setting the
object to null?
Pen bluePen = new Pen( Color.Blue, 2 );
//use pen
bluePen.Dispose();
as opposed to:
|
by: karthikbalaguru |
last post by:
Hi,
Will 'free' return the memory Immediately to the OS ?
Thx in advans,
Karthik Balaguru
|
by: david |
last post by:
I will past only two segments from the code it should be enough to see
what I did wrong, I think I know there I made a mistake, but how to
fix it I can not tell. This why I need help from you all.
Main code:
----------------
/* duomenu rasymas i faila */
dst = fopen(argv, "w");
if (dst != NULL) {
wordDBSize = sizeStack(wordDB);
|
by: vivek |
last post by:
Hello,
I have a pointer to a main structure which again consists of
structures, enums, char, int, float and again complex structures.
When i free all the contents of the main structure, it takes me a lot
of time (since i have to loop determining the data type and freeing
it). Is there any idea to free all the contents of the structure in
shortest possible time.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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...
|
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();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |