centos7 安装mysql

参考: http://www.2cto.com/database/201501/371451.html

安装环境   CentOS版本:CentOS-7

因为之前安装过,没有成功,但是有之前安装的文件,要先卸载

网上找了一个卸载的过程如下:

 a)查看系统中是否以rpm包安装的mysql:

[root@centos7 ~]# rpm -qa | grep -i mysql
MySQL-server-5.6.17-1.el6.i686
MySQL-client-5.6.17-1.el6.i686
b)卸载mysql
[root@centos7 ~]# rpm -e MySQL-server-5.6.17-1.el6.i686
[root@centos7 ~]# rpm -e MySQL-client-5.6.17-1.el6.i686
c)删除mysql服务
[root@centos7 ~]# chkconfig --list | grep -i mysql
[root@centos7 ~]# chkconfig --del mysql
d)删除分散mysql文件夹
[root@centos7 ~]# whereis mysql 或者 find / -name mysql

 mysql: /usr/lib/mysql /usr/share/mysql

清空相关mysql的所有目录以及文件
[root@centos7 ~]#rm -rf /usr/lib/mysql
[root@centos7 ~]#rm -rf /usr/share/mysql
[root@centos7 ~]#rm -rf /usr/my.cnf

 

下载并安装  官网下载

1. 解压下载的zip包,会发现有以下几个rpm包:

MySQL-client-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-devel-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-embedded-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-server-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-shared-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-shared-compat-advanced-5.6.22-1.el7.x86_64.rpm

MySQL-test-advanced-5.6.22-1.el7.x86_64.rpm

 

2. 卸载MariaDB(这一步没操作过)

如果直接点击rpm包安装会得到错误提示。因为CentOS的默认数据库已经不再是MySQL了,而是MariaDB,为什么呢?

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

查看当前安装的mariadb包:

[root@centos7 ~]# rpm -qa | grep mariadb

将它们统统强制性卸载掉:

[root@centos7 ~]# rpm -e --nodeps mariadb-libs-5.5.35-3.el7.x86_64

[root@centos7 ~]# rpm -e --nodeps mariadb-5.5.35-3.el7.x86_64

[root@centos7 ~]# rpm -e --nodeps mariadb-server-5.5.35-3.el7.x86_64

 

3. 安装MYSQL

按顺序执行

rpm -ivh MySQL-client-advanced-5.6.22-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-advanced-5.6.22-1.el7.x86_64.rpm
rpm -ivh MySQL-server-advanced-5.6.22-1.el7.x86_64.rpm

 完成..  

4. 启动MYSQL

[root@centos7 mysql]#service mysql start

查看MySQL运行状态:

[root@centos7 mysql]# service mysql status

SUCCESS! MySQL running (14158)

 

5. 默认root用户登录MYSQL

[root@centos7 mysql]# mysql -u root -p

Enter password:

ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)

发现有有错误,然后在网上查了一下说使用下面命令修改root初始化密码:

[root@centos7 mysql]# /usr/bin/mysqladmin -u root password 'passok'

/usr/bin/mysqladmin: connect to server at'localhost' failed

error: 'Accessdenied for user 'root'@'localhost' (using password: NO)'

发现MYSQL数据库默认的root用户还是没办法设置密码进行登录,需要做一下操作:

 

重置MySQL中root用户密码及验证

还是不行,然后在网上又找到一个重置MySQL中root用户密码及验证的方法:

(1) 停止MySQL服务

[root@centos7 mysql]# service mysql stop

Shutting down MySQL.. SUCCESS!

(2) 输入绕过密码认证命令

[root@centos7 mysql]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

[1] 5807

150117 22:23:31 mysqld_safe Logging to '/var/lib/mysql/bogon.err'.

150117 22:23:31 mysqld_safe Starting mysqlddaemon with databases from /var/lib/mysql

(3) 输入登录用户命令

[root@centos7 mysql]# mysql -u root mysql

Reading table information for completion oftable and column names

You can turn off this feature to get aquicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version:5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - AdvancedEdition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

(4)添加用户并赋予权限

mysql> use mysql;

mysql> create database MyShop; //创建一个数据库

//创建一个用户www并具有操作MyShop数据库的权限

mysql> grant all privileges on MyShop.* to 'www'@'localhost' identified by '888888';
mysql> flush privileges;

来查看一下权限

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM user;
+------------------------------+
| query |
+------------------------------+
| User: 'root'@'127.0.0.1'; |
| User: 'root'@'::1';          |
| User: 'root'@'centos7';   |
| User: 'www'@'localhost'; |
| User: 'root'@'localhost'; |
+------------------------------+
6 rows in set (0.00 sec)


mysql> show grants for 'www'@'localhost';
+----------------------------------------------------------------------------------------------------------------+
| Grants for www@localhost                                     |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'www'@'localhost' IDENTIFIED BY PASSWORD '*8E02B7AE57F9A19E165EB45CD3F705BF66985B85' |
| GRANT ALL PRIVILEGES ON `MyShop`.* TO 'www'@'localhost'                 |
+----------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

(5) 输入修改root密码SQL语句

mysql> udpate user SET Password=PASSWORD('root') where USER='root';

Query OK, 4 rows affected (0.04 sec)

Rows matched: 4 Changed: 4 Warnings: 0

(6) 输入数据刷新命令

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

(7) 退出

mysql> quit

Bye

(8) 启动MYSQL

[root@centos7 mysql]# service mysql start

Starting MySQL SUCCESS!

 

 

参考:http://www.cnblogs.com/XBlack/p/5178758.html

 

       http://www.cnblogs.com/benwu/p/4931944.html

 

 

-----------------------------------------------------------------分割-------------------------------------------------------------

以下为参考以上第二个 url博客操作的linux记录:

 

[root@localhost ~]# cd /

[root@localhost /]# su

[root@localhost /]# rpm -qa | grep mariadb

mariadb-server-5.5.52-1.el7.x86_64

mariadb-libs-5.5.52-1.el7.x86_64

mariadb-embedded-devel-5.5.52-1.el7.x86_64

mariadb-embedded-5.5.52-1.el7.x86_64

mariadb-test-5.5.52-1.el7.x86_64

mariadb-bench-5.5.52-1.el7.x86_64

mariadb-5.5.52-1.el7.x86_64

mariadb-devel-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e ma

madan-fonts             man-db                  mariadb                 mariadb-embedded        mariadb-server          

mailx                   man-pages               mariadb-bench           mariadb-embedded-devel  mariadb-test            

make                    man-pages-overrides     mariadb-devel           mariadb-libs            marisa                  

[root@localhost /]# rpm -e ma

madan-fonts             man-db                  mariadb                 mariadb-embedded        mariadb-server          

mailx                   man-pages               mariadb-bench           mariadb-embedded-devel  mariadb-test            

make                    man-pages-overrides     mariadb-devel           mariadb-libs            marisa                  

[root@localhost /]# rpm -e mariadb-server-5.5.52-1.el7.x86_64

error: Failed dependencies:

mariadb-server(x86-64) = 1:5.5.52-1.el7 is needed by (installed) mariadb-test-1:5.5.52-1.el7.x86_64

[root@localhost /]# ps -ef|grep mysql

root      6374   362  0 17:05 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=root

root      6514  6374  0 17:05 pts/1    00:00:03 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=root --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock

root     10439 10367  0 18:49 pts/2    00:00:00 grep --color=auto mysql

[root@localhost /]# kill -9 6374

[root@localhost /]# ps -ef|grep mysql

root      6514     1  0 17:05 pts/1    00:00:03 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=root --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock

root     10441 10367  0 18:49 pts/2    00:00:00 grep --color=auto mysql

[root@localhost /]# kill -9 6514

[root@localhost /]# ps -ef|grep mysql

root     10605 10367  0 18:50 pts/2    00:00:00 grep --color=auto mysql

[root@localhost /]# rpm -e --nodeps mariadb-server-5.5.52-1.el7.x86_64

warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave

[root@localhost /]# rpm -qa | grep mariadb

mariadb-libs-5.5.52-1.el7.x86_64

mariadb-embedded-devel-5.5.52-1.el7.x86_64

mariadb-embedded-5.5.52-1.el7.x86_64

mariadb-test-5.5.52-1.el7.x86_64

mariadb-bench-5.5.52-1.el7.x86_64

mariadb-5.5.52-1.el7.x86_64

mariadb-devel-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-embedded-devel-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-embedded-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-test-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodep mariadb-bench-5.5.52-1.el7.x86_64

rpm: --nodep: unknown option

[root@localhost /]# rpm -e --nodep mariadb-devel-5.5.52-1.el7.x86_64

rpm: --nodep: unknown option

[root@localhost /]# rpm -e --nodeps mariadb-devel-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -qa | grep mariadb

mariadb-bench-5.5.52-1.el7.x86_64

mariadb-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-bench-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -e --nodeps mariadb-5.5.52-1.el7.x86_64

[root@localhost /]# rpm -qa | grep mariadb

[root@localhost /]# rpm -ivh MySQL-client-advanced-5.6.22-1.el7.x86_64.rpm

error: open of MySQL-client-advanced-5.6.22-1.el7.x86_64.rpm failed: No such file or directory

[root@localhost /]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-release-el7-5    ################################# [100%]

[root@localhost /]# yum repolist enabled | grep "mysql.*-community.*"

mysql-connectors-community/x86_64       MySQL Connectors Community           30

mysql-tools-community/x86_64            MySQL Tools Community                43

mysql56-community/x86_64                MySQL 5.6 Community Server          306

[root@localhost /]# yum -y install mysql-community-server

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.tuna.tsinghua.edu.cn

 * extras: mirrors.cn99.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:5.6.35-2.el7 will be installed

--> Processing Dependency: mysql-community-common(x86-64) = 5.6.35-2.el7 for package: mysql-community-server-5.6.35-2.el7.x86_64

--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.35-2.el7.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.6.35-2.el7 will be installed

--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.35-2.el7.x86_64

---> Package mysql-community-common.x86_64 0:5.6.35-2.el7 will be installed

--> Running transaction check

---> Package mysql-community-libs.x86_64 0:5.6.35-2.el7 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

===========================================================================================================================================================

 Package                                     Arch                        Version                              Repository                              Size

===========================================================================================================================================================

Installing:

 mysql-community-server                      x86_64                      5.6.35-2.el7                         mysql56-community                       59 M

Installing for dependencies:

 mysql-community-client                      x86_64                      5.6.35-2.el7                         mysql56-community                       19 M

 mysql-community-common                      x86_64                      5.6.35-2.el7                         mysql56-community                      257 k

 mysql-community-libs                        x86_64                      5.6.35-2.el7                         mysql56-community                      2.0 M

 

Transaction Summary

===========================================================================================================================================================

Install  1 Package (+3 Dependent packages)

 

Total download size: 81 M

Installed size: 350 M

Downloading packages:

warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-client-5.6.35-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Public key for mysql-community-client-5.6.35-2.el7.x86_64.rpm is not installed

(1/4): mysql-community-client-5.6.35-2.el7.x86_64.rpm                                                                               |  19 MB  00:00:07     

(2/4): mysql-community-libs-5.6.35-2.el7.x86_64.rpm                                                                                 | 2.0 MB  00:00:00     

mysql-community-common-5.6.35- FAILED                                          ======-                                   ] 2.8 MB/s |  27 MB  00:00:19 ETA 

http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-common-5.6.35-2.el7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: repo.mysql.com; Name or service not known"

Trying other mirror.

(3/4): mysql-community-server-5.6.35-2.el7.x86_64.rpm                                                                               |  59 MB  00:00:40     

 

 

Error downloading packages:

  mysql-community-common-5.6.35-2.el7.x86_64: [Errno 256] No more mirrors to try.

 

[root@localhost /]# ps -ef|grep mysql

root     11089 10367  0 19:07 pts/2    00:00:00 grep --color=auto mysql

[root@localhost /]# service mysql start  

Redirecting to /bin/systemctl start  mysql.service

Failed to start mysql.service: Unit not found.

[root@localhost /]# service mysqld start 

Redirecting to /bin/systemctl start  mysqld.service

Failed to start mysqld.service: Unit not found.

[root@localhost /]# yum list  | grep mysql

mysql-community-release.noarch          el7-5                          installed

akonadi-mysql.x86_64                    1.9.2-4.el7                    base     

apr-util-mysql.x86_64                   1.5.2-6.el7                    base     

dovecot-mysql.x86_64                    1:2.2.10-7.el7                 base     

freeradius-mysql.x86_64                 3.0.4-7.el7_3                  updates  

libdbi-dbd-mysql.x86_64                 0.8.3-16.el7                   base     

mysql-community-bench.x86_64            5.6.35-2.el7                   mysql56-community

mysql-community-client.i686             5.6.35-2.el7                   mysql56-community

mysql-community-client.x86_64           5.6.35-2.el7                   mysql56-community

mysql-community-common.i686             5.6.35-2.el7                   mysql56-community

mysql-community-common.x86_64           5.6.35-2.el7                   mysql56-community

mysql-community-devel.i686              5.6.35-2.el7                   mysql56-community

mysql-community-devel.x86_64            5.6.35-2.el7                   mysql56-community

mysql-community-embedded.i686           5.6.35-2.el7                   mysql56-community

mysql-community-embedded.x86_64         5.6.35-2.el7                   mysql56-community

mysql-community-embedded-devel.i686     5.6.35-2.el7                   mysql56-community

mysql-community-embedded-devel.x86_64   5.6.35-2.el7                   mysql56-community

mysql-community-libs.i686               5.6.35-2.el7                   mysql56-community

mysql-community-libs.x86_64             5.6.35-2.el7                   mysql56-community

mysql-community-server.x86_64           5.6.35-2.el7                   mysql56-community

mysql-community-test.x86_64             5.6.35-2.el7                   mysql56-community

mysql-connector-java.noarch             1:5.1.25-3.el7                 base     

mysql-connector-odbc.x86_64             5.3.7-1.el7                    mysql-connectors-community

mysql-connector-odbc-debuginfo.x86_64   5.3.7-1.el7                    mysql-connectors-community

mysql-connector-odbc-setup.x86_64       5.3.7-1.el7                    mysql-connectors-community

mysql-connector-python.noarch           2.0.4-1.el7                    mysql-connectors-community

mysql-connector-python.x86_64           2.1.5-1.el7                    mysql-connectors-community

mysql-connector-python-cext.x86_64      2.1.5-1.el7                    mysql-connectors-community

mysql-connector-python-debuginfo.x86_64 2.1.5-1.el7                    mysql-connectors-community

mysql-ref-manual-5.6-en-html-chapter.noarch

                                        1-20170110                     mysql56-community

mysql-ref-manual-5.6-en-pdf.noarch      1-20170110                     mysql56-community

mysql-router.x86_64                     2.0.4-1.el7                    mysql-tools-community

mysql-router-debuginfo.x86_64           2.0.4-1.el7                    mysql-tools-community

mysql-utilities.noarch                  1.6.5-1.el7                    mysql-tools-community

mysql-utilities-extra.noarch            1.5.6-1.el7                    mysql-tools-community

mysql-workbench-community.x86_64        6.3.9-1.el7                    mysql-tools-community

mysql-workbench-community-debuginfo.x86_64

                                        6.3.9-1.el7                    mysql-tools-community

pcp-pmda-mysql.x86_64                   3.11.3-4.el7                   base     

php-mysql.x86_64                        5.4.16-42.el7                  base     

php-mysqlnd.x86_64                      5.4.16-42.el7                  base     

qt-mysql.i686                           1:4.8.5-13.el7                 base     

qt-mysql.x86_64                         1:4.8.5-13.el7                 base     

qt5-qtbase-mysql.i686                   5.6.1-10.el7                   base     

qt5-qtbase-mysql.x86_64                 5.6.1-10.el7                   base     

redland-mysql.x86_64                    1.0.16-6.el7                   base     

rsyslog-mysql.x86_64                    7.4.7-16.el7                   base     

[root@localhost /]# yum install mysql-community-common.x86_64

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.tuna.tsinghua.edu.cn

 * extras: mirrors.cn99.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-common.x86_64 0:5.6.35-2.el7 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

==========================================================================================================================================================================================================

 Package                                                 Arch                                    Version                                         Repository                                          Size

==========================================================================================================================================================================================================

Installing:

 mysql-community-common                                  x86_64                                  5.6.35-2.el7                                    mysql56-community                                  257 k

 

Transaction Summary

==========================================================================================================================================================================================================

Install  1 Package

 

Total download size: 257 k

Installed size: 2.1 M

Is this ok [y/d/N]: y

Downloading packages:

No Presto metadata available for mysql56-community

warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.35-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY        ]  0.0 B/s | 116 kB  --:--:-- ETA 

Public key for mysql-community-common-5.6.35-2.el7.x86_64.rpm is not installed

mysql-community-common-5.6.35-2.el7.x86_64.rpm                                                                                                                                     | 257 kB  00:00:01     

Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Importing GPG key 0x5072E1F5:

 Userid     : "MySQL Release Engineering "

 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5

 Package    : mysql-community-release-el7-5.noarch (installed)

 From       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:

perl-DBD-MySQL-4.023-5.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)

perl-DBD-MySQL-4.023-5.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)

2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)

2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)

  Installing : mysql-community-common-5.6.35-2.el7.x86_64                                                                                                                                             1/1 

  Verifying  : mysql-community-common-5.6.35-2.el7.x86_64                                                                                                                                             1/1 

 

Installed:

  mysql-community-common.x86_64 0:5.6.35-2.el7                                                                                                                                                            

 

Complete!

[root@localhost /]# service mysqld start 

Redirecting to /bin/systemctl start  mysqld.service

Failed to start mysqld.service: Unit not found.

[root@localhost /]# yum -y install mysql-community-server

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.tuna.tsinghua.edu.cn

 * extras: mirrors.cn99.com

 * updates: mirrors.tuna.tsinghua.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:5.6.35-2.el7 will be installed

--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.35-2.el7.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:5.6.35-2.el7 will be installed

--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.35-2.el7.x86_64

--> Running transaction check

---> Package mysql-community-libs.x86_64 0:5.6.35-2.el7 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

==========================================================================================================================================================================================================

 Package                                                 Arch                                    Version                                         Repository                                          Size

==========================================================================================================================================================================================================

Installing:

 mysql-community-server                                  x86_64                                  5.6.35-2.el7                                    mysql56-community                                   59 M

Installing for dependencies:

 mysql-community-client                                  x86_64                                  5.6.35-2.el7                                    mysql56-community                                   19 M

 mysql-community-libs                                    x86_64                                  5.6.35-2.el7                                    mysql56-community                                  2.0 M

 

Transaction Summary

==========================================================================================================================================================================================================

Install  1 Package (+2 Dependent packages)

 

Total size: 80 M

Installed size: 348 M

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : mysql-community-libs-5.6.35-2.el7.x86_64                                                                                                                                               1/3 

  Installing : mysql-community-client-5.6.35-2.el7.x86_64                                                                                                                                             2/3 

  Installing : mysql-community-server-5.6.35-2.el7.x86_64                                                                                                                                             3/3 

  Verifying  : mysql-community-client-5.6.35-2.el7.x86_64                                                                                                                                             1/3 

  Verifying  : mysql-community-libs-5.6.35-2.el7.x86_64                                                                                                                                               2/3 

  Verifying  : mysql-community-server-5.6.35-2.el7.x86_64                                                                                                                                             3/3 

 

Installed:

  mysql-community-server.x86_64 0:5.6.35-2.el7                                                                                                                                                            

 

Dependency Installed:

  mysql-community-client.x86_64 0:5.6.35-2.el7                                                         mysql-community-libs.x86_64 0:5.6.35-2.el7                                                        

 

Complete!

[root@localhost /]# service mysqld start 

Redirecting to /bin/systemctl start  mysqld.service

[root@localhost /]# ps -ef|grep mysql

mysql    11903     1  0 19:15 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr

mysql    12068 11903  3 19:15 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

root     12180 10367  0 19:15 pts/2    00:00:00 grep --color=auto mysql

[root@localhost /]# mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.35 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

你可能感兴趣的:(centos7 安装mysql)