Easiest way to Install MySQL in Linux


MySQL is the world's most popular open source database. With its proven performance, reliability, and ease-of-use, MySQL has become the leading database choice for web-based applications, used by high profile web properties including Facebook, Twitter, YouTube.



We can see the steps to install MySQL in CentOS 6.

1. To check grouplist
yum grouplist | grep -i mysql

2. To install whole package
yum groupinstall “mysql”

3. To verify installation
rpm -qa | grep -i mysql

4. Check the /etc/passwd and /etc/group to make sure it has created a mysql username and group.
vim /etc/passwd
                or
                grep mysql /etc/passwd

5. mysql_install_db program will setup the necessary grant tables.
                /usr/bin/mysql_install_db --user=mysql  
The mysql_install_db program gets executed as part of the rpm installation.


6. Start the service
service mysqld start
service mysqld status

7. Verify the mysql server is up and running
/usr/bin/mysqladmin version

8. To view DB
/usr/bin/mysqlshow

9. To view tables inside DB name
/usr/bin/mysqlshow blog →  (eg: /usr/bin/mysqlshow dbname).

stop and start the mysqd service to ensure there is no problem


10. Set password for root
mysql -u root
mysql> select host, user from mysql.user;
mysql> set password for 'root'@'localhost'=PASSWORD(‘****');
                            or (you can use your IP instead of localhost)
                mysql> set password for 'root'@'10.11.12.13'=PASSWORD('****’');

Note: We have seen easiest way to install MySQL in Linux machine. Mostly in production wont use above method to install MySQL only best way to get practice installing using source file. It will be discussed later after my few posts. 
Previous
Next Post »