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"参数的使用

  • 相关阅读:
    PagerIndicator主题样式修改
    写个Fragment方便的抽象基类 BaseFragment
    slidingMenu有时候需要关闭侧边栏
    通过构造方法传递数据
    三层ViewPager嵌套 的事件处理
    网络缓存的逻辑
    html中offsetTop、clientTop、scrollTop、offsetTop各属性介绍
    AJAX请求
    animation-name
    Sublime Text 2主要快捷键列表
  • 原文地址:https://www.cnblogs.com/kindnull/p/8998567.html
Copyright © 2011-2022 走看看