mySQL: Error 1045

Posted by jay on August 16, 2008

If you get this error (in phpMyAdmin or other operation) after setting up a MySQL password:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)

This might caused by phpMyAdmin’s configuration doesn’t have the new password. If using XAMPP, you need to update the /Applications/xampp/xamppfiles/phpmyadmin/config.inc.php for the phpMyAdmin:

$cfg['Servers'][$i]['password'] = 'YOURPASSWORD';

Change the YOURPASSWORD to the password you set before.

Also the /Applications/xampp/etc/my.cnf should be updated accordingly. The configration file specifies mysql’s setting. So dig in the file and update the settings:

# The following options will be passed to all MySQL clients
[client]
password	= YOURPASSWORD
port		= 3306
socket		= /Applications/xampp/xamppfiles/var/mysql/mysql.sock

Same here update the password.

Although setting up securities for local development is a little hassle as you need to type in password etc etc, I still recommend to set it properly.

VirtualHost browser cache

Posted by jay on August 10, 2008

Setting up a virtual host on PC, Mac or Linux isn’t difficult, but the browser cache problem drives me crazy. Apart from editing the /etc/hosts mappings and httpd.conf, you need to restart both Apache and browser. Refreshing the browser(Firefox) doesn’t clean the cache, so the result will be always add /xampp/index.php at the end of the virtual host name.

Leopard system environment PATH setting

Posted by jay on August 09, 2008

Leopard PATH setting is quite different from Tiger. Configuring PATH on Tiger, we used to either modify the /etc/path or user path configuration. With Leopard, system-wide path configuration is managed by /etc/profile. The file loads a path_helper script. So what the script does?

The path_helper constructs the system environment PATH in this order:

  1. Reads the local user configuration first, under ~/.bash_login
  2. Appends default system paths /usr/bin:/bin:/usr/sbin:/sbin
  3. Reads the paths line by line in /etc/paths
  4. Retrieves all the files in /etc/paths.d/ that contains other packages configurations. For example, I created a file /etc/paths.d/system and stuff in some user paths settings. They are appended after step 3.

In my case, I wanted my XAMPP packages overrides the default Leopard MySQL, PHP and Apache paths ( so I don’t have to type in /Application/xampp/xamppfile/bin to use the command every time, also the package is easier to manage ). So just put the paths in the ~/.bash_login, that will override the system default.

Close the Terminal and open it again, to check your path settings, type:

 echo $PATH

There we go, it’s updated.