Site Administration Page 3 - Setting Up Database Driven Websites |
Okay, we actually get to do something now! Assuming you've downloaded everything into /tmp, do this to install MySQL. The MySQL file you downloaded will be called something like mysql-3.22.21-pc-linux-gnu-i686.tar.gz, depending on your platform.. Extract this into /usr/local, you must do this as root:
After it extracts everything, a directory called mysql-3.22.21-pc-linux-gnu-i686 (or similar) will be created. We make a symlink to this directory and give it a friendlier name:
Next time there is a new version of MySQL, you can just extract the binary distribution to a new directory and change the symlink. Creating a MySQL UserNow 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:
First let's change the ownership of MySQL directories and files to be owned by the mysql user and the root group:
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:
If that didn't give you any error messages, you're well on your way. Make MySQL Start AutomaticallyMySQL comes with a little startup script in /usr/local/mysql/support-files called mysql.server. Make sure it is executable:
You should call this from one of your system startup scripts. As this is different for every operating system, refer to your system manual for more information on how to do this. Testing MySQLMySQL comes with a sample database called test and its internal database that keeps track of permissions and users, so let's fire it up and see if everything is working so far. First start up MySQL:
If that worked, you should be able to something like:
The MySQL programs files are located in /usr/local/mysql/bin, you may want to this to your path. Start the client by running:
You should see the following:
Next, list the installed databases by typing show databases:
You should see:
If you did, then it's working!! Exit MySQL by typing exit: Changing the Admin Password The first thing to do after everything works is to change the administrator password. Do this by running mysqladmin (remember that it may not be in your path):
This sets the password for the user root to newpassword. You probably don't want to use that, so substitute it with something clever.
blog comments powered by Disqus |
|
|
|
|
|
|
|