Running the BitNami LAMP stack with the system MySQL

Submitted by admin on Tue, 10/06/2009 - 09:36

The excellent BitNami LAMP stack contains its own MySQL, which is started automatically and used by PHP. If you for some reason want to use the MySQL that is installed in your host system you can do the following changes to your stack configuration:

Step 1 - Prevent the stack control script from starting MySQL

Edit the file ctlscript.sh in your LAMP stack root directory. and change the line

MYSQL_SCRIPT=$INSTALLDIR/mysql/scripts/ctl.sh

to

MYSQL_SCRIPT=$INSTALLDIR/mysql/scripts/ctl.shx

i e, add an x to the end of the path to the MySQL control script. This will prevent the rest of the script from finding the file and MySQL will be ignored. This will also make the stack start much faster.

Step 2 - Make PHP use your system MySQL socket

Edit the file php/etc/php.ini, relative to your LAMP stack root directory, and edit the following properties

  • mysql.default_port
  • mysql.default_socket
  • mysqli.default_port
  • mysqli.default_socket

The default_port properties are set to the port number you chose when you installed the LAMP stack. Change them to the port your system MySQL uses, probably 3306.

The default_socket properties point to mysql/tmp/mysql.sock inside your LAMP stack. Change them to your system MySQL socket. On my SuSE system that would be /var/run/mysql/mysql.sock.

Step 3 - Restart your stack

In your LAMP stack root, run the command

./ctlscript.sh restart

That's it!

 

Add new comment

Plain clean text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.