Linux Reality Episode 57 - PHP and MySQL Extra Notes 1. PHP To install php4 or php5, use your package manager to install these packages: php4 or php5 maybe also libapache2-mod-php4 or libapache2-mod-php5 PHP configuration file is called php.ini, and is usually found in: /etc/php4 or /etc/php5 You usually do not need to edit this file. To test your PHP configuration, create a file called "index.php" in your website (Apache) directory and enter the following in the file: Then, you can browse to "localhost/index.php" and it will show you some information on PHP. 2. MySQL To install MySQL, use your package manager to install these packages: mysql-server libapache2-mod-auth-mysql php4-mysql or, if you are using php5: mysql-server libapache2-mod-auth-mysql php5-mysql To start, stop, or restart MySQL, one usually does as root: /etc/init.d/mysql start or /etc/init.d/mysqld start The MySQL configuration file is located at: /etc/mysql/my.cnf but one usually does not need to edit this file. To set the MySQL root password: sudo mysqladmin -u root password 1234 This sets the MySQL root user's password to 1234. Then, to log in to the MySQL server, enter: mysql -u root -p enter password: 1234 You will then get a MySQL prompt that looks something like this: mysql> When entering commands at the MySQL prompt, you must must have a semicolon at the end of each line before pressing Enter. To create a database, do the following at the MySQL prompt: mysql> CREATE DATABASE wordpress; This will create a database called "wordpress." The next step is to create a separate non-root MySQL user with a password and to grant all privileges to that non-root user. This can be done all in one step as follows: mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'bloguser'@'localhost' IDENTIFIED BY 'abcd'; (That is all on one line.) Then, do the following: mysql> FLUSH PRIVILEGES; mysql> EXIT; You will then be back at the regular command prompt. Updated: Tue Apr 10 20:19:01 EDT 2007