MySQL Database Installation on CentOS server

I. Download the latest release RPM of MySQL

Download MySQL rpm from Mysql.com or here Download community edition for your specific linux architecture. If you use 32 bit architecture then you must download these RPMs.

MySQL-client-community-6.0.9-0.rhel5.i386.rpm
MySQL-server-community-6.0.9-0.rhel5.i386.rpm
MySQL-devel-community-6.0.9-0.rhel5.i386.rpm

II. Before Installation you check default MySQL that installed on the time of Linux Installation and remove it.

You don’t perform this activity on that system where Mysql used by some Applications.

[root@localhost ~]# rpm -qa | grep -i mysql
mysql-5.0.22-2.1.0.1
mysqlclient10-3.23.58-4.RHEL4.1

[root@localhost ~]# rpm -e mysql-5.0.22-2.1.0.1 –nodeps
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[root@localhost opt]# rpm -e mysqlclient10-3.23.58-4.RHEL4.1
III. Install the downloaded RPMs packages:

Install MySQL-server and MySQL-client rpm pack

[root@localhost ~]# rpm -ivh MySQL-server-community-6.0.9-0.rhel5.i386.rpm MySQL-client-community-6.0.9-0.rhel5.i386.rpm
Preparing… ########################################### [100%]
1:MySQL-client-community ########################################### [ 50%]
2:MySQL-server-community ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h localhost.localdomain password ‘new-password’

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL……….. SUCCESS!
Giving mysqld 2 seconds to start

Now you install the MySQL-devel-community-6.0.9-0.rhel5.i386.rpm
package

[root@localhost ~]# rpm -ivh MySQL-devel-community-6.0.9-0.rhel5.i386.rpm
Preparing… ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]

IV. Perform post Installation activities.

You should set password for root user, the best option for this purpose you use
/usr/bin/mysql_secure_installation
[root@localhost ~]# /usr/bin/mysql_secure_installation

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] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
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] Y
… 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] Y
… 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.you
Remove test database and access to it? [Y/n] Y
– 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] Y
… 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!

V. Now you use MySQL with root user

[root@localhost ~]# mysql -uroot -p
Enter password:*************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 6.0.9-alpha-community MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

VI. MySQL start/stop/status:

[root@localhost ~]# service mysql status
SUCCESS! MySQL running (3674)
[root@localhost ~]# service mysql stop
Shutting down MySQL.. SUCCESS!
[root@localhost ~]# service mysql start
Starting MySQL.. SUCCESS!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s