This tutorial is an introductory guide to get you started in the world of server-side-scripting and web databases. It covers installation and configuration of MySQL, Apache, and PHP. An example script is also included as a guide for making your own server-side-scripts.
Now we will create a user account to run the MySQL server daemons and to own all the MySQL files. Add a new user called mysql on your system using whatever commands are available for your OS (eg. useradd). No one should be logging into this account, so disable logins by:
setting the account expiry to a date in the past
entering NP or * in the password field of /etc/passwd or /etc/shadow
whatever your OS recommends
First let's change the ownership of MySQL directories and files to be owned by the mysql user and the root group:
# cd /usr/local
# chown -R mysql mysql-3.22.22-pc-linux-gnu-i686 mysql
# chgrp -R root mysql-3.22.22-pc-linux-gnu-i686 mysql
Now we have to run a little script that creates the initial MySQL database, do this a the mysql user. This is the only time we use this account directly:
# su mysql
$ cd mysql
If that didn't give you any error messages, you're well on your way.
Make MySQL Start Automatically
MySQL comes with a little startup script in /usr/local/mysql/support-files called mysql.server. Make sure it is executable: