LAMP on Slackware (Part 3)
Assuming all went well in the previous steps, it's time to setup the MySQL database server.
The very first step is to have a look at the /etc/my-*.cnffiles
Have a look through them and decide which one suits your environment. Then copy it to /etc/my.cnf like this:
cp /etc/my-small.cnf /etc/my.cnfNow execute the following commands in this order:
chmod 0755 /etc/rc.d/rc.mysqld
chown -R mysql:mysql /var/lib/mysql
mysql_secure_installationYou'll be prompted for a root mysql password.
This and all other mysql user passwords are completely independant from the system passwords so don't confuse them!
Follow the prompts and choose the most secure options that suit your situation.
When connecting to a MySQL database you normally have two options, A TCP/IP port (3306) or a unix socket (/var/run/mysql/mysql.sock).
Usually your webserver and users are on the same host so the most secure method is to use the Unix socket (this is the default in Slackware).
If you do need to connect to the database over the network (The database not the webserver) then you'll need to comment the following line in
SKIP="--skip-networking" and then restart the mysqld service.
Putting it to use
The instructions that come with most LAMP based software rarely take Slackware into account but armed with the knowledge gained from this article you should be able to get most things running.
Remember to specify the location of the Unix Socket and that your "root" database password is different than your system one
A common issue that arises is the "short_open_tag" option this is disabled by default as it forces more portable coding practices. If you are just seeing blank pages where you expected content, check that the "php tags" in the code are the long format
short tags example
some php code();
?>and the preferred long format tags
some php code();
?>If you find the that the pages are full of short tags you'll need to edit the /etc/httpd/php.ini and set
short_open_tag = OnAnd restart the httpd service.
Remember: The log files are your first stop when trouble-shooting
Hopefully by now you are ready to make use of your server.