w3resource logo

MySQL Tutorial

MySQL installation on Linux and Windows

Secondary Nav

installation on Linux and Windows

In this section we are going to discuss how to install MySQL on windows and Linux machines.

Download MySQL

You can download MySQL from http://dev.MySQL.com/downloads/.

Install MySQL on Linux (RedHat and its variants)

1. After downloading the required RPM package, you have to run the appropriate package with root privilege.

Syntax :

 rpm -i PackageName.rpm 

With the similar syntax, you can install MySQL client, workbench or any other software downloaded and required.

Install MySQL on Linux (Ubuntu and Debian)

Syntax for installing MySQL server

apt-get install MySQL-server

Syntax for installing PHP module MySQL

sudo apt-get install php5-MySQL

Install MySQL on Windows

Download the binary distributions (MSI files) of MySQL server and other necessary MySQL tools from MySQL site.

Run MSI files on your Windows Machines. Make sure that you have privilege for installing software applications. Follow the instructions.

After the installation is completed, if you want to make PHP work with MySQL, make sure you complete the following steps -

1. Open php.ini file. Find and uncomment the following lines -

2. Create a php file on the root of your Apache or any other web server you are using. Write echo phpinfo(); in that php file. Run that PHP file form your browser (http://localhost/info.php, if your php file name is info.php). You should be able to see the following output if you have configured PHP and MySQL properly.

MySQL installation on windows

Note : phpinfo() displays a long list of information about PHP installation. We have shown the MySQL part only.

Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program