Tuesday, June 23, 2009

Using MySQL Administrator with WampServer

For those readers who do not develop PHP on Windows platform WampServer is probably the most popular Apache + MySQL + PHP package for Windows. MySQL Administrator on the other hand, is a part of MySQL GUI Tools package.

The problem with this pair, is that they don't want to work together. At least not right out of box. MySQL Administrator fails to find mysql service process as installed by WampServer. This leads to infamous 'Could not find settings' error message.

You still will be able to use MySQL Administrator, but some of its features will be unavailable - among them quite important 'Startup variables' that lets you configure your server.

The reason is simple. WampServer keeps MySQL's config file in a directory, that is not checked by MySQL Administrator's searching algorithm.

Luckily, the solution is also simple.

Open registry editor
Windows XP: Go to Start > Run... type in regedit and press Enter
Vista: Go to Start, type regedit into search box and press Enter

A word of warning: be careful when using registry editor, as you might break your system if you change wrong variables.

Using tree on the left go to:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\wampmysqld

In the window on the right find ImagePath variable, double click it's name.

In the dialog that opens you should see something like this:
c:\wamp\bin\mysql\mysql5.1.33\bin\mysqld.exe wampmysqld
(MySQL's version may vary)

Change it like this:
"c:\wamp\bin\mysql\mysql5.1.33\bin\mysqld.exe" --defaults-file="c:\wamp\bin\mysql\mysql5.1.33\my.ini" wampmysqld
(be careful not to miss any double quotes!

Close registry editor, then restart you MySQL server from WampServer's tray menu.

MySQL Administrator should work fine now.

That would be it ;)

----

MySQL Forums post, where I've found this solution|Database Software Development by Expert Developers, UK

Thursday, June 18, 2009

SSH Auto-mount Network Share

(Beware - This blog/tutorial is directed towards linux based users)
When doing any type of work, especially web work, one of the royal pains is FTPing to your server, or any type of file transfer. Well now you can make it quick and painless. Let me introduce SSHFS. There are 3 major components when creating the SSHFS, and I will guide you through creating and installing all of the necessary steps. Now you can mount and use your file system to automatically upload files and folders to your server with ease.

The 3 Major components:

  1. SSH Automatic Login
  2. Install SSHFS
  3. Mount your folder(s)

SSH Automatic Login

Run this command (with the obvious variable substitutions). It should create a public ssh key on your server.

ssh-copy-id [-i [identity_file]] [user@]machine
  1. ssh-keygen -t dsa
  2. ssh-copy-id user@machiner.

Check to make sure it's there, the file should be called, "authorized_keys".

ls -al ~/.ssh/

If you're having trouble with this part, you can reference this tutorial which breaks this component into smaller steps: SSH Automatic Login.

Install SSHFS

sudo apt-get install sshfs

Or use whatever package manager your distribution provides.

Mount

Create a shell script, we'll call it "mount.sh", and add the contents:

sshfs [user]@[your_server].com:/dir/on/server /dir/to/mount

Run the script:

./mount.sh

Go to the mounted directory and run the 'ls' command to make sure all of your files/folders from your server show up in your local directory.

After you have this successfully working you should at it to your startup scripts.

System >> Preferences >> Sessions >> [add_a_new_entry]

You should be all set. You should have an automatic SSH login (no prompt for a password) from your computer to your server and a mounted folder to your server that acts as an automatic FTP client. The files in your mounted directory should be synced with that of your server. Now all you have to do is move or copy your desired files/folders into the mounted directory, and voila, they're on your server.