Centos安装Mysql客户端

2018-06-30  本文已影响0人  异想天开的猪

一、判断是否已安装MYSQL

which mysql
which mysqldump

输出如下内容表示未安装

[root@centos6 ~]# which mysql
/usr/bin/which: no mysql in (/usr/local/sbin:/usr/local/bin
:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@centos6 ~]# which mysqldump
/usr/bin/which: no mysqldump in (/usr/local/sbin
:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

输入如下内容表示已安装

[root@centos6 ~]# which mysql
/usr/bin/mysql
[root@centos6 ~]# which mysqldump
/usr/bin/mysqldump

二、安装mysql客户端

yum install mysql 

再次测试安装情况,步骤同(一、判断是否已安装MYSQL)

which mysql
which mysqldump

三、操作全过程

[root@centos6 ~]# which mysql
/usr/bin/which: no mysql in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@centos6 ~]# which mysqldump
/usr/bin/which: no mysqldump in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@centos6 ~]# yum install mysql
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
 * webtatic: us-east.repo.webtatic.com
解决依赖关系
--> 执行事务检查
---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be 安装
--> 完成依赖关系计算

依赖关系解决

==============================================================================================================================================
 软件包                         架构                            版本                                      仓库                           大小
==============================================================================================================================================
正在安装:
 mysql                          x86_64                          5.1.73-8.el6_8                            base                          895 k

事务概要
==============================================================================================================================================
Install       1 Package(s)

总下载量:895 k
Installed size: 2.4 M
确定吗?[y/N]:y
下载软件包:
mysql-5.1.73-8.el6_8.x86_64.rpm                                                                                        | 895 kB     00:00
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
  正在安装   : mysql-5.1.73-8.el6_8.x86_64                                                                                                1/1
  Verifying  : mysql-5.1.73-8.el6_8.x86_64                                                                                                1/1

已安装:
  mysql.x86_64 0:5.1.73-8.el6_8

完毕!
[root@centos6 ~]# which mysql
/usr/bin/mysql
[root@centos6 ~]# which mysqldump
/usr/bin/mysqldump
[root@centos6 ~]# mysql -u root -p -h 127.0.0.1
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17561945
Server version: 5.6.34 Source distribution

Copyright (c) 2000, 2013, 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.

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| db_speaker_server  |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)

mysql> exit;
Bye
[root@centos6 ~]#
上一篇下一篇

猜你喜欢

热点阅读