CentOS6中的mysql及基本用法

mysql数据库摘要

CentOS6中的mysql及基本用法

1、查看mysql-server包信息

[root@CentOS6 ~]#yum info mysql-server

1528180146(1)

2、安装mysql-server包

[root@CentOS6 ~]#yum install mysql-server

1

注意:安装mysql-server包的时候系统自动帮我们安装了客户端包mysql。

3、客户端登陆mysql

[root@CentOS6 ~]#mysql

CentOS6中的mysql及基本用法0

出现上图所示,表示已经登陆到mysql数据库,可以开始正常的增删改查操作了!

4、mysql数据库的使用

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.73 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> help     //根据系统提示输入help或者是\h之后会显示mysql的操作快捷键

mysql> show databases;     //查看当前数据库中所有的数据库列表

3

mysql> system hostname ;\!  ls     //在mysql数据库中执行linux系统命令。前面加system或者\! 

4

mysql> status     //查看当前数据库的状态信息

5

mysql> use  mysql;     //进入mysql数据库

6

mysql> use  mysql;     //进入mysql数据库

6

mysql> show  tables;     //查看mysql数据库的文件内容

7

mysql> select user,host,password  from  user;     //查看mysql数据库中user表中的用户,主机,密码三项内容

8

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/100427

(6)
JllbcJllbc
上一篇 2018-06-05 15:29
下一篇 2018-06-05 18:33

相关推荐

  • Linux用户、组以及正则表达式练习题

    Linux用户、组以及正则表达式练习题 复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其他用户均没有任何访问权限 [root@localhost ~]# cp -r /etc/skel /home/tuser1 [root@localhost ~]# chmod 700 /home/tuser1 -R …

    Linux笔记 2018-06-02
  • systemctl命令

    systemctl

    Linux笔记 2018-04-24
  • 第五周作业

    1、简述rpm与yum命令的常见选项,并举例
    2、自建yum仓库,分别为网络源和本地源
    3、简述at和crontab命令,制定 每周三凌晨三、五点10分执行某个脚本,输出当前时间,时间格式为 2017-12-28 10:00:00
    4、简述sed常用操作命令,并举例

    Linux笔记 2018-06-11
  • 網絡屬性配置2

    網絡屬性配置2 一.ip命令 [root@centos7 ~]# rpm -qf /usr/sbin/ip 或[root@centos7 ~]# rpm -qf `which ip` iproute-3.10.0-87.el7.x86_64 (查看某個文件是由哪個程序包安裝生成) ip – show / manipulate routing, d…

    Linux笔记 2018-05-03
  • bash的工作特性

    bash特性:命令执行状态返回值 bash命令的执行状态分为两种:1. 成功,状态返回值为0。2. 失败,状态返回值为1-255。bash使用特殊变量$?保存最近一条命令的执行状态结果: [Azuth@azuth ~]$ id root &>/dev/null[Azuth@azuth ~]$ echo $?0[Azuth@azuth ~]$ i…

    Linux笔记 2018-05-20
  • mysql数据库的安装

    实战:rpm包安装 1、yum安装 centos6上yum install mysql-server rpm -ql mysql-server /etc/rc.d/init.d/mysqld  服务名(服务脚本的名称) /usr/libexec/mysqld  数据库的主程序(二进制的程序路径与平时看到的二进制程序路径不一样) /var/lib/mysql …

    Linux笔记 2018-06-11