First Download the MySql sever and Client. Download the correct Linux Operating system and Machine Architecture.
- MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpm
- MySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm
Then install the server and then the client.
- rpm -ivh MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpm
- rpm -ivh MySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm
After successfully installing both. Check the file in this location /root/.mysql_secret. This file contains the mysql root password which is randomly generated.
Afterwords start the mysql server using below command.
- /etc/init.d/mysql start
Then type mysql -u root or mysql and try to connect.
If it provides below errors.
- ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)
- Access denied for user ‘root’@'localhost’ (using password: NO)
Solution is to open vi /etc/my.cnf and then insert the following to the file and save. After words you will be able to connect to mysql.
[client]
user=”root”
pass=”XXXXXXXX”