Presentation is loading. Please wait.

Presentation is loading. Please wait.

Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.

Similar presentations


Presentation on theme: "Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration."— Presentation transcript:

1 Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration

2 MySQL Installation Installing with Windows : Go to the source Web site, www.mysql.com, and click “downloads (GA)” on the navigation bar, choose MySQL Community Server, click download.download Select Platform “Microsoft Windows”. Choose latest stable version and click the MSI file to initiate download. (If you don’t have an account you must register first) Unzip the file to a temporary directory of your choice. Click setup.exe to run the installation program. You will see the first of the Installation Wizard screens. Click Next to display the informational screen. We highly recommend that you read this screen before you continue. Click Next, which brings you to the Choose Destination Location screen.

3 MySQL Installation Installing with Windows : If the default directory is acceptable, simply click Next; otherwise, click Browse and select a different destination Click Next. The next screen allows you to customize your installation; typical installation is sufficient for most users. Click the setup type you prefer, and click Next to begin the installation. After installing the appropriate files, the final screen will simply indicate the installation is complete. Click Finish to end the wizard

4 MySQL Installation Installing with Linux : Go to the source Web site, www.mysql.com, and click “downloads (GA)” on the navigation bar, choose MySQL Community Server, click download.download Select Platform for your appropriate Linux Distro. Choose latest stable version and grab the tarball. (If you don’t have an account you must register first). Open a console window and change the directory (cd) to the folder where you downloaded the tarball. If there isn’t a user on the system dedicated to running the mysql daemon (typically mysql), you’ll need to create one. To do this, in the console, enter the following commands : groupadd mysql useradd –g mysql mysql

5 MySQL Installation Installing with Linux : Extract the tarball, and change to the directory it creates : VERSION is the (sub)version of the mysql source tarball you downloaded. Next, configure the source this way : Using the --prefix switch tells the installer where to put the mysql libraries and binaries after they’re built. Compile the source : tar –xzf mysql-VERSION.tar.gz cd mysql-VERSION./configure --prefix=/usr/local/mysql make

6 MySQL Installation Installing with Linux : Install the libraries and binaries : Note that you will need to be logged in as superuser (root) to perform this step and the following steps in the MySQL installation. If this is the first time MySQL has been installed on your machine (in other words, not an upgrade), run this script to install the initial database/tables : make install scripts/mysql_install_db

7 MySQL Installation Installing with Linux : Fix permissions on installed files, and copy over the default configuration file : Any changes you wish to make to customize MySQL should be made in this file. Start the MySQL daemon : You’ll probably want to add the previous command to whatever facilities are available to automatically start the daemon at boot. This varies by OS. Here is one easy way to add this that works with most systems (but may not be the best way) : chown –R root /usr/local/mysql chown –R mysql /usr/local/mysql/var chgrp –R mysql /usr/local/mysql cp support-files/my-medium.cnf /etc/my.cnf /usr/local/mysql/bin/mysqld_safe --user=mysql & echo ‘/usr/local/mysql/bin/mysqld_safe --user=mysql &’ >> /etc/rc.local

8 Testing Installation For Windows 95/98/Me, at the DOS prompt, change directories until you are in the MySQL server main directory (the default is c:\mysql\bin\). Then type For Windows 2000/XP/NT, at the DOS prompt, change directories until you are in the MySQL server main directory and type. You should see a screen that looks similar to the one shown below c:\mysql\bin>mysqld c:\mysql\bin>mysqld --install

9 Testing Installation To start the MySQL server, type the following : Your screen will look like the one shown below. Now you should test to make sure your MySQL server is running. Although there are many possible commands to test the server, to keep things simple use the following: c:\>NET START MySQL C:\>c:\mysql\bin\mysql test

10 Testing Installation Your screen should look something like the one shown below : To return to the DOS prompt, enter the following : To stop the server from running, type the following : To shut down the MySQL service, type : mysql>exit or mysql>quit c:\>NET STOP MySQL C:\>c:\mysql\bin\mysqladmin -u root shutdown

11 Configuration Default installation is insecure. No password All rights granted Root can log in from anywhere Need to secure installation

12 Configuration Secure using the provided utility. This script does the following: Removes anonymous user. Disalows remote root login. Removes Test Database. mysql_secure_installation

13 Basic Administration Assigning User Rights Grant privileges to data bases: Grants all privileges to user mike on all databases. These users are just stored as entries in a database, and you can edit the records directly if you want. GRANT ALL PRIVILEGES ON *.* TO ‘user'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO ‘user'@'%' WITH GRANT OPTION;

14 Basic Administration Adding Users From the mysql client : Creates local and remote user ‘user’. The '@' part matches hostnames, '%' is a wildcard. You can restrict users to only connect from a certain host. mysql> create user ‘user'@'localhost' identified by 'password'; mysql> create user ‘user'@'%' identified by 'password';

15 References References : 1.Anonymous.(n.d.). Apache HTTP Server Documentation Version 2.2. Retrieved from http://httpd.apache.org/docs/2.2/.http://httpd.apache.org/docs/2.2/ 2.Achour, M., Betz, F. (n.d.), PHP Manual. Retrieved from http://www.php.net/download-docs.php. http://www.php.net/download-docs.php 3.Anonymous. (n.d.). MySQL Reference Manual. Retrieved from http://downloads.mysql.com/docs/. http://downloads.mysql.com/docs/ 4.Naramore, E., Gerner, J., Le Scouarnec, Y., Stolz, J., Glass, M. K. (2005). Beginning PHP5, Apache, and MySQL® Web Development. Indianapolis, IN: Wiley Publishing, Inc.


Download ppt "Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration."

Similar presentations


Ads by Google