zoukankan      html  css  js  c++  java
  • MySQL常见的启动和操作(MySQL.5.7.x)

    1、手动启动:

     1 [root@node ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
     2 [1] 15689
     3 [root@node ~]# nets2018-05-06T08:10:50.238854Z mysqld_safe Logging to '/data/mysql/error.log'.
     4 t2018-05-06T08:10:50.293504Z mysqld_safe Starting mysqld daemon with databases from /data/mysql
     5 
     6 -bash: netst: command not found
     7 [root@node ~]# netstat -unltp|grep 3306
     8 tcp6       0      0 :::3306                 :::*                    LISTEN      16984/mysqld        
     9 [root@node ~]# ps xua|grep mysqld
    10 root      15689  0.2  0.0 113252  1660 pts/0    S    16:10   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
    11 mysql     16984  1.1 14.7 2331244 275008 pts/0  Sl   16:10   0:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/error.log --open-files-limit=65535 --pid-file=node.pid --socket=/tmp/mysql.sock --port=3306
    12 root      17027  0.0  0.0 112644   952 pts/0    S+   16:11   0:00 grep --color=auto mysqld
    13 [root@node ~]# 

    2、手动关闭:

    1 [root@node ~]# /usr/local/mysql/bin/mysqladmin -uroot -hlocalhost -proot@123 shutdown
    2 mysqladmin: [Warning] Using a password on the command line interface can be insecure.
    3 [root@node ~]# 2018-05-06T08:12:58.958427Z mysqld_safe mysqld from pid file /data/mysql/node.pid ended
    4 
    5 [1]+  Done                    /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf
    6 [root@node ~]# 
    7 [root@node ~]# ps xua|grep mysqld
    8 root      17036  0.0  0.0 112644   952 pts/0    S+   16:13   0:00 grep --color=auto mysqld
    9 [root@node ~]# 

    3、shell下查看MySQL数据库下表结构:

     1 [root@node ~]# mysql -uroot -hlocalhost -p -e "use mysql;select User,Host,authentication_string from user;"
     2 Enter password: 
     3 +---------------+-----------+-------------------------------------------+
     4 | User          | Host      | authentication_string                     |
     5 +---------------+-----------+-------------------------------------------+
     6 | root          | localhost | *A00C34073A26B40AB4307650BFB9309D6BFA6999 |
     7 | mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
     8 | mysql.sys     | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
     9 +---------------+-----------+-------------------------------------------+
    10 [root@node ~]# 

    注意"-e"参数的使用

  • 相关阅读:
    MFC STATIC,Picture控件使用及无法添加变量的问题
    MFC listctrl NMCLICK消息 错误 无法从"NMHDR*"转换为"NMITEMACTIVATE"
    vs2008中将开始执行按钮(不调试按钮)添加至标准工具栏方法
    MFC 删除工具栏 默认对话框全屏 修改MFC标题栏的文字 删除菜单栏
    Visual Assist X设置
    MFC禁止窗口最大化按钮和禁止改变窗口大小
    MFC从头开始如何利用MFC分割窗口
    MFC CSplitterWnd窗口分割
    关于VS2008下提示microsoft incremental linker已停止工作的问题
    windows 下codeblocks查看容器值
  • 原文地址:https://www.cnblogs.com/kindnull/p/8998567.html
Copyright © 2011-2022 走看看