mySQL is the world's most popular database. It serves as the back-end database engine for numerous websites. This is a step-by-step guide to installing mySQL on a Linux server. This mySQL installation guide assumes that you know what mySQL is and how to use it.
mySQL installation notes:
- For the sample mySQL installation in this guide, I'll be using Red Hat Linux 7.3 and tarball version mysql-3.23.55.tar.gz.
- Throughout the mySQL installation guide, <enter> means press the Enter key on the keyboard.
Steps for installing mySQL:
- Download the mySQL source files from the mySQL website.
- Once you have downloaded the mySQL source files and decompressed them, configure the installation directory.
Navigate to the root directory and type the following:
./configure --prefix=/usr/local/mysql <enter>.
This will cause mySQL to be installed in this directory:
/usr/local/mysql
You can change the mySQL installation directory if you wish, but the remainder of this mySQL installation guide will assume this is where you are installing mySQL.
- Now you're ready to build and install mySQL.
Type make <enter>.
This make process may take a few minutes. After it finishes, type make install <enter>.
This step will definitely take a few minutes. After it completes, you should see a bunch of new files in the /usr/local/mysql directory.
- Next, you need to initialize mySQL.
Type cd /scripts <enter>.
Type ./mysql_install_db <enter>.
- Configure the password.
Type cd /usr/local/mysql <enter>.
Type ./safe_mysqld& <enter>.
Type ./mysqladmin -uroot -p[your-password-goes-here] <enter>.
- Add mySQL to the Linux Start and Stop Run Levels.
Type the following in sequence:
cp support-files/mysql.server /etc/rc.d/init.d/mysql <enter>.
chmod +x /etc/rc.d/init.d/mysql <enter>.
cd /etc/rc.d/rc3.d <enter>.
ln -s ../init.d/mysql S85mysql <enter>.
cd /etc/rc.d/rc5.d <enter>.
ln -s ../init.d/mysql S85mysql <enter>.
cd /etc/rc.d/rc0.d <enter>.
ln -s ../init.d/mysql K85mysql <enter>.
cd /etc/rc.d/rc6.d <enter>.
ln -s ../init.d/mysql K85mysql <enter>.
- Reboot your system and test the mySQL installation.
Type:
cd /usr/local/mysql <enter>.
bin/mysqladmin -uroot -p[your-password-goes-here] ping <enter>.
The following response should now be displayed: mysqld is alive
You have now successfully installed mySQL. You might wish to add the mysql bin directory to your PATH.
Jason Lam is a skilled IT professional, programmer, and trainer. You can find his excellent tutorials on his website: http://www.jasonlam604.com
More Interesting Articles |