Install mysql using yum in centos
1. add yum data source (1.1) Get the right data source from the http://dev.mysql.com/downloads/repo/yum/ (1.2) install the data source package shell> sudo rpm-Uvh platform-and-version-specific-package-name.rpmeg: install Red Hat Enterprise Linux 7/Oracle Linux 7 (Architecture Independent), RPM Package shell> wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpmshell> sudo rpm-Uvh mysql57-community-release-el7-7.noarch.rpm2. select an appropriate installation version (2.1) to view the mysql Data Source Package shell> sudo yum repolist all | grep mysql (2.2) edit/etc/yum. repos. d/mysql-community.repo, Enable the corresponding mysql version # Enable to use MySQL 5.6 [mysql56-community] name = MySQL 5.6 Community Serverbaseurl = connector [mysql57-community] name = MySQL 5.7 Community Serverbaseurl = http://repo.mysql.com/yu M/mysql-5.7-community/el/7/$ basearch/enabled = 1 gpgcheck = 1 gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-mysql ps: "enabled = 1" enabled, "enabled = 0" disabled, the above configuration is to install "mysql 5.7" and disable "mysql 5.6" (2.3) view mysql activation list shell> sudo yum repolist enabled | grep mysqlmysql-connectors-community/x86_64 MySQL Connectors Community/x86_64 MySQL Tools Community 27mysql57-community/x86_64 MySQL 5.7 community Ser Ver 20 3. install mysql shell> sudo yum install mysql-community-server Note: when installing mysql 5.7 using yum, A temporary root password is randomly generated and saved to the error log ("/var/log/mysqld. log "), you can use the following command to view: shell> sudo grep 'temporary password'/var/log/mysqld. log therefore, after installing mysql 5.7, you need to change the password as soon as possible. 4. start mysql Server shell> yum -- disablerepo = \ * -- enablerepo = 'mysql *-community * 'list available (4.1) start command shell> sudo service mysqld start (4.2) view mysql status shell> sudo service mysqld status5.mysql _ secure_installation use mysql_secure_installation to set the root password, delete anonymous users and other important operations shell> mysql_secure_installation 6. install an additional mysql tool (6.1) to view the available package name shell> mysql_secure_installation (6.2) Installation Package shell> sudo yum install package name, for example: install mysql-workbench-community shell> sudo yum install mysql-workbench-community 7. upgrade mysql (7.1) and edit/etc/yum. repos. d/mysql-community.repo (7.2) execute update shell> sudo yum update mysql-server or use the following command to update all packages shell> sudo yum update8. centos7 replace mysql with mariadb database by default, first, uninstall the mariadb package (8.1) to query the maridb package command shell> sudo rpm-qa | grep-I mariadb (8.2) to delete shell> sudo rpm-e related package name