Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Details on running mysql_secure_installation script.

...

Restrict the Execution of PHP to a Specific Folder

Using Edit php.ini to only allow execution of php scripts in specific directories.

Code Block
languagebash
sudo, edit, vi /etc/php5/apache2/php.ini

...

Search the open_basedir line and modify,

Code Block
; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/open-basedir
open_basedir = /opt/www.krypton.com/www/blog/:/opt/www.earth.com/www/blog/

...

For the root administration database password, use the standard password algorithm based on the server name.

Connect PHP to MySQL

Install the necessary libraries so that PHP will be able to connect to MySQL.

Code Block
languagebash
sudo apt-get install php5-mysql 

Configure MySQL

Secure MySQL

Still working this out - http://dev.mysql.com/doc/refman/5.0/en/mysql-secure-installation.html

Connect PHP to MySQL

Install the necessary libraries so that PHP will be able to connect to MySQL.

Code Block
languagebash
sudo apt-get install php5-mysql 

Create the Accounts in MySQL

Connect As a staff user run the Secure Installation script included with MySQL,

Code Block
languagebash
mysql_secure_installation

The prompts are very straightforward. Except for "Change the Root password?", answer yes to all prompts by hitting Enter,

Code Block
collapsetrue
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
 ... skipping.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] 
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] 
 ... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] 
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL! 

For now that's it to securing MySQL.

Connect

Connect into MySQL,

Code Block
languagebash
mysql -u root -p 

The password to use is the password set during the MySQL install. If everything goes well you will be in the MySQL shell,

Code Block
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

The remainder of this section happens inside of the mysql shell.

Create the Accounts in MySQL

Enter the following MySQL commands,

Code Block
languagesql
CREATE DATABASE wpkryptondb;
GRANT ALL PRIVILEGES ON wpkryptondb.* TO 'wpkryptonuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT

Adjust the variables for your application.

...

Tip

Database Admins will not like granting all privileges. After the initial setup is done we will restrict to more minimal privileges.

 

Exit MySQL Shell

Exit the MySQL shell,

Code Block
languagesql
EXIT

A

Setup WordPress

Install WordPress

...