MySQL not loading in PHP on Windows

There seems to be bug in MySQL 5.0.41. I stumbled across this when I tried to install a new isntallation of wordpress with the up to date versions I keeps getting a message “cannot load MySQL extension, please check PHP Configuration”. You can verify this also by running the following command: “php -m”. If you recieve a message lett ing you know that it can not load the MySQL dynamic library then this might be your problem. this is a know bug documented here:

http://bugs.mysql.com/bug.php?id=28358

problem: MySQL no loading in PHP

Fix: download a recompled version of libmysql.dll at:
http://www.tomdonovan.net/download/libmysql_5.0.41_Win32.zip
Replace all instances on your system.

thanks to the much smarter MySQL folks for this temporary fix.

MySQL backup for a Windows Administrator

As a windows Administrator we are asked to deal many varying technologies. Not all of them are native to the Windows platform, but are rather ports from the Linux world. While in most cases we are not asked to generally do nothing more than install and let the customer then customize as they see fit every once and a while your are asked to make backups for various reasons.

It is important to understand much like MS SQL, MySQL uses live data files that are constantly open. While there are some good choices in the MS SQL world for live backups the same can’t be said for MySQL. Therefore it is essential to create a flat file that most backup programs can store in case of emergencies.

I will step through creating a full MySQL database back up via an external program called ‘mysqldump’. The action is often referred to as a data dump. Using this technique not only creates a backup of your data but the associated structures that the data is held in. This makes it very easy to move in case such an even is needed.

Problem: create a complete flat file backup for MySQL

Fix: Open a command line window. type the following command: ‘ –opt –user=root mysqldump –all-databases > backup.sql’

Drive mapping in Terminal services

Today a client asked how they could drag and drop files when connecting to their Windows 2003 server. I responded with the normal, “you can do this by connecting to your FTP server on a Windows server…”. They were not thrilled. When dealing with a wide variety of clients you run the gambit of skill levels and effort.

Generally, they want things to be as easy as possible with a little complication as possible. Unless of course this violates security policies. In most cases your job is to balance what benefits your client versus the potential pitfalls. In the case of the new Windows remote desktop this was easily accomdatated.

Problem: securely transfer files will as little hassle as possible
Fix: enable ‘drive mapping’ for terminal services
How to:

1. Open Terminal services configuration\connections (tscc)
2. open the ‘navigation’ folder’
3. Open the properties for ‘RDP-Tcp’
4. click on the ‘client settings’ tab
5. clear the ‘drive mapping’ option box
6. click okay
7. close tscc

The next time your client logs in they will see their local drives mapped as part of the server’s additional drives. Now they can cut-n-paste with ease and still keep the secure connection.

NOTE: there are added notes here:  Drive mapping in Terminal services part 2

MySQL change root password for Windows

In a shared environment you are asked to tackle many strange tasks and not so strange tasks. Among my many common tasks that I’m asked to look into is management of MySQL on a windows platform. While there are plenty of instructions on how to manage MySQL in a linux environment there are little such documentation for a Windows platform.

I won’t go into the merits of MySQL on a Windows or Linux platform. As a system administrator you are asked to manage and fix problem not decided what is the best course of action.

To reset a root password in Windows is not really not much a difficult task so I’ll out line it here:

Problem: lost root password for MySQL windows implamentation
Fix:

  1. Stop the MySQL services
  2. open a command window and use the following command: “C:\<wherever_you_installed_MySQL>\bin\mysqld-nt –skip-grant-tables”
  3. open a second command window and user the following command: “c:\mysql -u root”
  4. This will start MySQL command line interface, now type: “use mysql;”
  5.  Next type in: “update user set password=PASSWORD(“some_new_password”) where Use=’root’;”
  6. now type in: “flush privileges;”
  7. finally: “quit”

You will have to restart the Windows server, but once this is complete you would have reset the MySQL root password.

PHP POST coding issues

As a system administrator you deal with many technologies. Alot of the times you don’t feel like you have a total grasp as you feel you should to properly should in order to be an effective adminstrator. For me this is PHP. While it has been around a while this particular technology is usually in the realm of the web developer. As in most things it does require adminsitrtors to know at least some things when the delevoper gets stuck on a particular problem.

In my case it was a PHP POST problem. When the devleoper moved thier code to a new Windows box. They ran across a stange problem. They couldn’t make post statements from thier form page into a resulting post page. As it had worked before the natural path was to blame the system and not the code.

The solution turned out to be a mixture of both. In previous default installation the PHP.ini variable register_globals was set to true. In a new PHP installation this is set to false.  While it could be argues that it was a system problem or a coding issue in the end it really doesn’t matter to the client. just as long as it working.

Problem: POST not working in PHP
Solution: Set PHP.ini variable register_globals to true.