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

  • 相关阅读:
    负载均衡器部署方式和工作原理
    Android 有关于* daemon not running.starting it now on port 5037 *ADB
    微信开发常用文档及参考资料
    XML解析之sax解析案例(二)使用sax解析把 xml文档封装成对象
    XML解析之sax解析案例(一)读取contact.xml文件,完整输出文档内容
    XML解析之SAX解析过程代码详解
    通过PHP current()函数获取未知字符键名数组第一个元素的值
    PHP检测链接是否是SSL连接 ,也就是判断HTTPS
    PHP反射ReflectionClass、ReflectionMethod 入门教程
    PHP 反射API说明
  • 原文地址:https://www.cnblogs.com/kindnull/p/8998567.html
Copyright © 2020-2023  润新知