I have seen most prolific and established software engineers/domain experts sometimes left guessing on how to fix simple installation and setup issues on Linux boxes. The primary reason is obsessive exposure to windows machines and lack of proper experience on the Linux architecture. To fix installation/setup issues it is important to understand the UNIX architecture and specifics of the software that is being installed or setup.
Installing Mysql on Linux is simple and easy but it can easily become messy by using different users with varying permissions and modifying the files with different users that create a lock on the files or make them inaccessible to the intended user profile.
To create a a fresh installation of Mysql first check if there are any existing installations present on the Linux box. This can be checked by using the following command on the shell:
rpm -qa | grep -i Mysql
or
ls /etc/int.d | grep -i mysql
If Mysql is installed then uninstall it using the following command:
rpm -evf <mysql-package-name>
After Mysql installation is removed you can download latest or the required Mysql package and install it using the following command:
rpm -i <mysql-package-name>.rpm
The installation creates the following entries on the UNIX box:
The installation will create a user named mysql and a group named mysql. Creation of these users and groups require administrative privileges to the user which is being used for installing Mysql. The user needs to have the privilege to run the following commands useradd, groupadd, and usermod on the UNIX system.
Now try to start Mysql server by running the following command:
/usr/bin/mysqld_safe &
and check the status of Mysql server using the command:
service mysql status
If it does not start then check the error logs in the /var/lib/mysql directory in a file named *err*.
If the logs have the error message: [ERROR] Fatal Error: Can’t open and lock privilege tables: table doesn’t exist
then to run the following command:
mysql_install_db --user=mysql --ldata=/var/lib/mysql
Mysql should start successfully after doing the above steps.
Installing Mysql on Linux is simple and easy but it can easily become messy by using different users with varying permissions and modifying the files with different users that create a lock on the files or make them inaccessible to the intended user profile.
Installation of Mysql on Linux
To create a a fresh installation of Mysql first check if there are any existing installations present on the Linux box. This can be checked by using the following command on the shell:
rpm -qa | grep -i Mysql
or
ls /etc/int.d | grep -i mysql
If Mysql is installed then uninstall it using the following command:
rpm -evf <mysql-package-name>
After Mysql installation is removed you can download latest or the required Mysql package and install it using the following command:
rpm -i <mysql-package-name>.rpm
The installation creates the following entries on the UNIX box:
- /etc/init.d entries: to start the server automatically at boot time
- /var/lib/mysql entries: for logfile and database
- /usr/lib/mysql entries: for putting mysql libraries
- /usr/sbin entries: for mysqld server
- /usr/bin entries: for client programs and scripts
The installation will create a user named mysql and a group named mysql. Creation of these users and groups require administrative privileges to the user which is being used for installing Mysql. The user needs to have the privilege to run the following commands useradd, groupadd, and usermod on the UNIX system.
Now try to start Mysql server by running the following command:
/usr/bin/mysqld_safe &
and check the status of Mysql server using the command:
service mysql status
If it does not start then check the error logs in the /var/lib/mysql directory in a file named *err*.
If the logs have the error message: [ERROR] Fatal Error: Can’t open and lock privilege tables: table doesn’t exist
then to run the following command:
mysql_install_db --user=mysql --ldata=/var/lib/mysql
Mysql should start successfully after doing the above steps.
No comments:
Post a Comment