mysql

Can't connect to MySQL server on 'localhost' (10061)

I recently installed MySQL 5 on windows 2003 and tried configuring an instance. Everything worked fine until i got to "Applying Security settings", at which point it gave me the above error. I do have a port 3306 exception in my firewall for 'MySQL Server'. Please help. ...

PHP unserialize keeps throwing same error over 100 times.

So I have a large 2d array that i serialize and base64_encode and throw into a database. On a different page I pull the array out and when I base64_decode the serialized array i can echo it out and it definitely looks valid. However, if i try to unserialize(base64_decode($serializedArray)) It just throws the same error to the point of ...

Timed events with php/MySQL

I need a way to modify a value in a table after a certain amount of time has passed. My current method is as follow: insert end time for wait period in table when a user loads a page requesting the value to be changed, check to see if current >= end time if it is, change the value and remove the end time field, if it isn't, do nothing...

Mysql results in PHP - arrays or objects?

Been using PHP/MySQL for a little while now, and I'm wondering if there are any specific advantages (performance or otherwise) to using mysql_fetch_object() vs mysql_fetch_assoc() / mysql_fetch_array(). ...

To Update blindly or to Update Where?

I have a table that holds information about cities in a game, you can build one building each turn and this is recorded with the value "usedBuilding". Each turn I will run a script that alters usedBuilding to 0, the question is, which of the following two ways is faster and does it actually matter which way is used? UPDATE cities SET u...

Connection Interrupted. The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection.

I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this: Connection Interrupted The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection. Please try again. Any advice? ...

"SELECT * FROM users WHERE id IN ( )" == FAIL

I have a function that I use called sqlf(), it emulates prepared statements. For instance I can do things like: $sql = sqlf("SELECT * FROM Users WHERE name= :1 AND email= :2",'Big "John"','[email protected]') ; For various reasons, I cannot use prepared statements, but I would like to emulate them. The problem that I run into is with ...

Is there a tool like Microsoft's "SQL Server Profiler" for MySQL?

While developing on MySQL I really miss being able to fire up a profiler. I find SQLyog is a good enough replacement for Query Analyzer but have not found a tool that works like SQL profiler. For the MySQL folk who have not seen Microsoft's SQL Profiler, here is a screenshot At my previous job we had a tool that trumped SQL Profile...

PHP code to convert a MySQL query to CSV

What is the most efficient way to convert a MySQL query to CSV in PHP please? It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required). The CSV should also include one top line of field names. Cheers. ...

Mysql search and replace some text in a field

What Mysql query will do a text search and replace in one particular field in a table? ie search for 'foo' and replace with 'bar' so a record with a field with the value : 'hello foo' becomes: 'hello bar'. ...

Interactive SVG - Learning Resources?

Has anyone any reources for learning how to implement SVG with php/mysql (and possibly with php-gtk)? I am thinking of making a top-down garden designer, with drag and drop predefined elements (such as trees/bushes) and definable areas of planting (circles/squares). Gardeners could then track over time how well planting did in a certain ...

Where do the responsibilities of a Db Abstraction in PHP start and end?

In PHP, what is the best practice for laying out the responsibilities of a Db Abstraction Layer? Is OOP a good idea in terms of performance? How much should be generic object code, and how much should be very specific functions? ...

Does an index help with < or > MySQL queries?

If I have a query like "DELETE FROM table WHERE datetime_field < '2008-01-01 00:00:00'", does having the 'datetime_field' column indexed help? i.e. is the index only useful when using equality (or inequality) testing, or is it useful when doing an ordered comparison as well? (Suggestions for better executing this query, without recreat...

Change database files location in MySQL administrator?

Dear all, I would like to change the database files location of MySQL administrator to another drive of my computer. ( i run windows xp SP2, mySQL Administrator 1.2.8) --Under the startup variable --> General Parameters --> i change the Data directory: C:/Program Files/MySQL/MySQL Server 5.0/data to D:/..... but after i stop the service...

Best MySQL Server Monitoring Tool

I'd like some opinions about the best mysql monitoring tool available. I've tried MySQL Enterprise Monitor, and it is great for me except it's impossible to get MySQL sell something (see comments for details) - I'm ok to pay even if I find the pricing and bundling it with MySQL Enterprise only unreasonable. I am also looking at MONyog M...

How do I check if index exists on a table field in mysql

I've needed to Google this a couple times, so I'm sharing my Q/A. ...

Is there a good tool for MySQL that will help me optimise my queries and index settings?

I use MySQL in a fairly complex web site (PHP driven). Ideally, there would be a tool I could use that would help me test the SQL queries I am using and suggest better table indexes that will improve performance and avoid table scans. Failing that, something that will tell me exactly what each query is up to, so I can perform the optim...

View grants in MySQL

How do I view the grants (access rights) for a given user in MySQL? ...

Is there something wrong with joins that don't use the JOIN keyword in SQL or MySQL?

When I started writing database queries I didn't know the JOIN keyword yet and naturally I just extended what I already knew and wrote queries like this: SELECT a.someRow, b.someRow FROM tableA AS a, tableB AS b WHERE a.ID=b.ID AND b.ID= $someVar Now that I know that this is the same as an INNER JOIN I find all these queries in my c...

Fetch one row per account id from list, part 2

Not sure how to ask a followup on SO, but this is in reference to an earlier question: http://stackoverflow.com/questions/94930/fetch-one-row-per-account-id-from-list The query I'm working with is: SELECT * FROM scores s1 WHERE accountid NOT IN (SELECT accountid FROM scores s2 WHERE s1.score < s2.score) ORDER BY score DESC This selec...