I’m following the directions on the page called ApacheMySQLPHP in the section called Installing MYSQL with PHP 5.
Use any method to install
mysql-server libapache2-mod-auth-mysql php5-mysql
Password for “root” MySQL User
During the command line install of
mysql-server I was asked to create this password. The P/W is the same as my laptop’s.
|P/W:||the same as my laptop’s|
It’s best not to change the root password which I just set because it’s complicated to do it on the command line; and it can really get things screwed up!
memory_limit in php.ini
The UBUNTU instructions say:
You may need to increase the memory limit that PHP imposes on a script. Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value.
This is not necessary because the current version of
128M as the current
php.ini setting for
memory_limit. Which is enough!
Set mysql bind address
Before you can access the database from other computers in your network, you have to change its bind address. Note that this can be a security problem, because your database can be accessed by other computers than your own. Skip this step if the applications which require
mysql are running on the same machine.
So, I skipped it!
Create a mysql database
mysql -u root -p mysql> CREATE DATABASE samehrlabib_aTestMyLAMP;
Now there is a database called:
To exit the mysql client:
Every mysql command must end with a ; or \g . A \q is for exiting the mysql CLI.
Create a mysql user
For creating a new user with all privileges (use only for troubleshooting), at
mysql prompt type:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
For creating a new user with fewer privileges (should work for most web applications) which can only use the database named
mysql prompt type:
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword';
yourpassword can be anything you like.
database1 is the name of the database the user gets access to.
localhost is the location which gets access to your database. You can change it to
'%' (or to hostnames or ip addresses) to allow connections from every location (or only from specific locations) to the database. Note, that this can be a security problem and should only be used for testing purposes!
When I created the database
samehrlabib_aTestMyLAMP I had intended it to be used by a user named
samehrlabib. This user will have fewer privileges than someone like
root. Now, I’ll create this
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON samehrlabib_aTestMyLAMP.* TO 'samehrlabib'@'localhost' IDENTIFIED BY 'password';
This is not the exact command. Substitute the password. The actual P/W for samehrlabib mysql user is the same as it is on my iMac (etnashar(nemra)_girls(3araby)_esm-kalby-el-tany).
Install phpMyAdmin (PMA)
I thought I wouldn’t have to install PMA because I assumed I’d find the files for the
phpMyAdmin scripts in my
Dropbox directory—and thereby not have to install anything. But, I didn’t find them in
So, where did I put them when I installed
phpMyAdmin on my iMac?
In the web share directory on my iMac.
So, I guess that’s also where these script will end up being placed on my laptop.
But how did PMA end up having the URL
http://sameh-labibs-imac.local/phpMyAdmin/ on the iMac?
Mostly, by using Apache2 Alias directive. See post about my iMac install and this one: What a File Path Represents in Apache Configuration. There is a lot more to this if you want to get it right.
Therefore, I’ll need to install PMA.
apt-get install phpmyadmin
apt-get command installed the following packages:
phpmyadmin php5-gd php5-mcrypt dbconfig-common
also, it modified the Apache configuration— although, for some reason, it didn’t create an
Alias directive for the redirection of
/phpmyadmin in a URL to the actual directory of the phpmyadmin script in the file system—see my previous remarks. MORE ON THIS BELOW.
dbconfig-common was a terminal GUI which helped prepare the database for
phpmyadmin. To accomplish this it created a new database called
phpmyadmin; then, it assisted in creating a user for this particular database:
|P/W:||the same as for my other users on this laptop|
This user/database combo allows PMA to maintain its settings.
Never change the password for the
phpmyadmin@localhost unless you are willing to also change it in
Two configuration files were created:
This user is configured with limited permissions. The user
phpmyadmin@localhost is for the use of the advanced phpMyAdmin configuration storage features.
I’ll never have to login to PMA as this user; because, the U/N and P/W are set in a PMA configuration file called config.inc.php.
Apache configuration for phpmyadmin
I placed an Apache configuration file for PMA in the directory
/etc/apache2/conf.d . The content for this new configuration file which I created was copied from
/etc/phpmyadmin/apache.conf . I named this file
So now the active Apache configuration file for PMA is: