CentOS installation and configuration MySQL database graphic detailed explanation

Install mysql database

a) Download the mysql source installation package: wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm, the system will download it automatically


b) Install mysql source: yum localinstall mysql57-community-release-el7-8.noarch.rpm, if complete! appears at the end, the MySQL source installation is complete


 c) Check whether the installation is complete: yum repolist enabled | grep "mysql.*-community.*"


d) Install mysql: yum install mysql-community-server, if Complete! appears at the end, the MySQL installation is complete


e) Set to start mysql service: systemctl enable mysqld


f) View the installed mysql version: rpm -aq | grep -i mysql


g) Start MySQL service: systemctl restart mysqld

Up to these places, mysql has been installed.

Note: Only mysql is installed now, and we don’t know the default password. Now I will show you how to change the password.

h) Use vim to modify the configuration file vim /etc/my.cnf and add a sentence to the [mysqld] section: skip-grant-tables save and exit vim.


i) Use the more command to query whether the configuration file has been modified, more /etc/my.cnf

j) Restart mysqld

k) Log in and modify the MySQL root password

Enter the system mysql
    mysql> mysql;
change the password to root
    mysql> UPDATE user SET Password = password ('root') WHERE User ='root';
mysql You need to use flush privileges to refresh the MySQL system privileges after setting up a new user or changing the password Table, otherwise there will be denied access
    mysql> flush privileges;
exit
    mysql> quit


l) Login verification



At this point, all installation and password changes are basically completed, I hope I can help you. Please mark everywhere for reprinting, thank you! !


Guess you like

Origin blog.csdn.net/dgxin_605/article/details/81049451
Recommended