sudo yum install mysql-server
sudo service mysqld start
mysql_secure_installation #follow instructions to reset root password and configure privileges
20230910 -
Things have changed.... following installation guide was easy but will normalize few things here...
I am installing mysql community edition in virtual machine (OS- CentOS Linux release 7.9.2009 (Core) (3.10.0-1160.95.1.el7.x86_64), HW- changeable).
Downloaded - https://repo.mysql.com//mysql80-community-release-el7-10.noarch.rpm
sudo yum install mysql80-community-release-el7-10.noarch.rpm # downloaded file from step 1, This adds repo of packages to yum.
sudo yum info mysql-community-server # This indicates if package is found and could be installed.
sudo yum install mysql-community-server # This installs server along with required dependencies and minimal tools such as client.
service mysqld status # see if mysql is running , Obviously it will not be running for now. but incase if you have restarted node after step 4 then you may see it running .
sudo grep 'temporary password' /var/log/mysqld.log #this shows temporary password for root@localhost user and should be updated first.
mysql -uroot -p
Enter password: #paste password from output of step 6.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW COMPLEX* PASSWORD>';
disconnect and reconnect using new password. should be fine to go from here....
For Java development, we need to install connector.
sudo yum list all | grep mysql-connector # find connector package to install for your app language.
sudo yum install mysql-connector-java # this adds a connector*.jar in path /usr/share/java/. that can be added to classpath of our java app.