日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql root命令_设置更改root密码、连接mysql、mysql常用命令

發(fā)布時間:2025/3/15 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql root命令_设置更改root密码、连接mysql、mysql常用命令 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

目錄

一、設(shè)置更改root密碼

二、連接mysql

三、mysql常用命令

一、設(shè)置更改root密碼

檢查mysql服務(wù)是否啟動

[root@minglinux-01 ~] ps aux |grep mysql

root 828 0.0 0.0 115640 1824 ? S 03:15 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/minglinux-01.pid

mysql 1199 0.0 24.7 1320112 462216 ? Sl 03:15 0:59 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=minglinux-01.err --pid-file=/data/mysql/minglinux-01.pid --socket=/tmp/mysql.sock --port=3306

root 6529 0.0 0.0 112724 984 pts/0 S+ 21:34 0:00 grep --color=auto mysql

mysql啟動

[root@minglinux-01 ~] mysql

-bash: mysql: 未找到命令 //只單獨輸入一個mysql命令是不行的,因為Mysql相關(guān)命令在/usr/local/mysql/bin路徑下,但該路徑不在環(huán)境變量PATH中

[root@minglinux-01 ~] echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

[root@minglinux-01 ~] export PATH=$PATH:/usr/local/mysql/bin/ //臨時生效,系統(tǒng)重啟后失效

[root@minglinux-01 ~] echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin/

[root@minglinux-01 ~] echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile //永久生效

[root@minglinux-01 ~] source /etc/profile

[root@minglinux-01 ~] mysql -uroot -p //指定使用root用戶登錄mysql,-p參數(shù)用于指定密碼。root用戶是MySQL自帶的管理員賬戶,默認是沒有密碼的。

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.39-log MySQL Community Server (GPL)

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

mysql> quit //quit退出mysql

Bye

給root用戶設(shè)定密碼

[root@minglinux-01 ~] mysqladmin -uroot password '123456'

Warning: Using a password on the command line interface can be insecure. //警告明文密碼不安全

[root@minglinux-01 ~] mysql -uroot //不指定密碼無法登錄,

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@minglinux-01 ~] mysql -uroot -p'123456'

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 5.6.39-log MySQL Community Server (GPL)

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

輸入密碼時需要加-p選項,后面可以直接跟密碼。-p選項后面不可以有空格,密碼可以不加單引號(但是密碼中有特殊字符時就會出問題,所以最好還是加上單引號)。當然,-p選項后面也可以不加密碼,以和用戶交互的方式輸入密碼。

再次修改root用戶密碼

[root@minglinux-01 ~] mysqladmin -uroot -p'123456' password 'toor'

Warning: Using a password on the command line interface can be insecure.

[root@minglinux-01 ~] mysql -uroot -p'toor'

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 13

Server version: 5.6.39-log MySQL Community Server (GPL)

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

在不知道root密碼的情況下修改root密碼

修改/etc/my.cnf配置文件,增加一行skip-grant

[root@minglinux-01 ~] vim /etc/my.cnf

7 [mysqld]

8 skip-grant //忽略授權(quán),即用戶登錄mysql時不需要密碼

[root@minglinux-01 ~] /etc/init.d/mysqld restart

Shutting down MySQL.. SUCCESS!

Starting MySQL. SUCCESS!

···

[root@minglinux-01 ~] mysql -uroot //無需密碼直接登錄

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.39-log MySQL Community Server (GPL)

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

通過修改mysql庫中的user表來修改root密碼

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| test |

+--------------------+

4 rows in set (0.00 sec)

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select * from user; //user表這記錄了用戶名、密碼、權(quán)限等信息

mysql> select password from user; //密碼信息是加密的字符串,這些加密的字符串由password函數(shù)生成,所以修改密碼時也需要password函數(shù)對密碼進行加密

+-------------------------------------------+

| password |

+-------------------------------------------+

| *9CFBBC772F3F6C106020035386DA5BBBF1249A11 |

| |

| |

| |

| |

| |

+-------------------------------------------+

6 rows in set (0.00 sec)

mysql> update user set password=password('123456') where user='root'; //修改密碼為123456

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4 Changed: 4 Warnings: 0

測試

刪除/etc/my.cnf中的skip-grant后重啟mysql再進行測試

[root@minglinux-01 ~] vim /etc/my.cnf

[root@minglinux-01 ~] /etc/init.d/mysqld restart

Shutting down MySQL.. SUCCESS!

Starting MySQL. SUCCESS!

[root@minglinux-01 ~] mysql -uroot -p'123456'

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.39-log MySQL Community Server (GPL)

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

二、連接mysql

mysql -uroot -p123456 //連接本機

mysql -uroot -p123456 -h127.0.0.1 -P3306 //指定IP和端口號遠程連接

mysql -uroot -p123456 -S/tmp/mysql.sock //Socket連接

mysql -uroot -p123456 -e ''show databases'' //連接后執(zhí)行操作,常用于shell腳本

[root@minglinux-01 ~] mysql -uroot -p123456 -e 'show databases'

Warning: Using a password on the command line interface can be insecure.

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| test |

+--------------------+

三、mysql常用命令

查詢庫 show databases

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| test |

+--------------------+

4 rows in set (0.00 sec)

切換庫 use mysql

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

查看庫里的表 show tables

mysql> show tables;

+---------------------------+

| Tables_in_mysql |

+---------------------------+

| columns_priv |

| db |

| event |

| func |

| general_log |

| help_category |

| help_keyword |

| help_relation |

| help_topic |

| innodb_index_stats |

| innodb_table_stats |

| ndb_binlog_index |

| plugin |

| proc |

| procs_priv |

| proxies_priv |

| servers |

| slave_master_info |

| slave_relay_log_info |

| slave_worker_info |

| slow_log |

| tables_priv |

| time_zone |

| time_zone_leap_second |

| time_zone_name |

| time_zone_transition |

| time_zone_transition_type |

| user |

+---------------------------+

28 rows in set (0.00 sec)

查看表里的字段 desc tb_name

mysql> desc user;

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Field | Type | Null | Key | Default | Extra |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Host | char(60) | NO | PRI | | |

| User | char(16) | NO | PRI | | |

| Password | char(41) | NO | | | |

| Select_priv | enum('N','Y') | NO | | N | |

| Insert_priv | enum('N','Y') | NO | | N | |

| Update_priv | enum('N','Y') | NO | | N | |

| Delete_priv | enum('N','Y') | NO | | N | |

| Create_priv | enum('N','Y') | NO | | N | |

| Drop_priv | enum('N','Y') | NO | | N | |

| Reload_priv | enum('N','Y') | NO | | N | |

| Shutdown_priv | enum('N','Y') | NO | | N | |

| Process_priv | enum('N','Y') | NO | | N | |

| File_priv | enum('N','Y') | NO | | N | |

| Grant_priv | enum('N','Y') | NO | | N | |

| References_priv | enum('N','Y') | NO | | N | |

| Index_priv | enum('N','Y') | NO | | N | |

| Alter_priv | enum('N','Y') | NO | | N | |

| Show_db_priv | enum('N','Y') | NO | | N | |

| Super_priv | enum('N','Y') | NO | | N | |

| Create_tmp_table_priv | enum('N','Y') | NO | | N | |

| Lock_tables_priv | enum('N','Y') | NO | | N | |

| Execute_priv | enum('N','Y') | NO | | N | |

| Repl_slave_priv | enum('N','Y') | NO | | N | |

| Repl_client_priv | enum('N','Y') | NO | | N | |

| Create_view_priv | enum('N','Y') | NO | | N | |

| Show_view_priv | enum('N','Y') | NO | | N | |

| Create_routine_priv | enum('N','Y') | NO | | N | |

| Alter_routine_priv | enum('N','Y') | NO | | N | |

| Create_user_priv | enum('N','Y') | NO | | N | |

| Event_priv | enum('N','Y') | NO | | N | |

| Trigger_priv | enum('N','Y') | NO | | N | |

| Create_tablespace_priv | enum('N','Y') | NO | | N | |

| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |

| ssl_cipher | blob | NO | | NULL | |

| x509_issuer | blob | NO | | NULL | |

| x509_subject | blob | NO | | NULL | |

| max_questions | int(11) unsigned | NO | | 0 | |

| max_updates | int(11) unsigned | NO | | 0 | |

| max_connections | int(11) unsigned | NO | | 0 | |

| max_user_connections | int(11) unsigned | NO | | 0 | |

| plugin | char(64) | YES | | mysql_native_password | |

| authentication_string | text | YES | | NULL | |

| password_expired | enum('N','Y') | NO | | N | |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

43 rows in set (0.00 sec)

查看建表語句 show create table tb_name\G

mysql> show create table user\G;

*************************** 1. row ***************************

Table: user

Create Table: CREATE TABLE `user` (

`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',

`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',

`Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',

`Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',

`ssl_cipher` blob NOT NULL,

`x509_issuer` blob NOT NULL,

`x509_subject` blob NOT NULL,

`max_questions` int(11) unsigned NOT NULL DEFAULT '0',

`max_updates` int(11) unsigned NOT NULL DEFAULT '0',

`max_connections` int(11) unsigned NOT NULL DEFAULT '0',

`max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',

`plugin` char(64) COLLATE utf8_bin DEFAULT 'mysql_native_password',

`authentication_string` text COLLATE utf8_bin,

`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',

PRIMARY KEY (`Host`,`User`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'

1 row in set (0.00 sec)

ERROR:

No query specified

命令加\G的目的是讓列出來的結(jié)果豎排顯示,這樣看起來更清晰。

查看當前用戶 select user()

mysql> select user();

+----------------+

| user() |

+----------------+

| root@localhost |

+----------------+

1 row in set (0.00 sec)

[root@minglinux-01 ~] mysql -uroot -p123456 -h192.168.162.130 //

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 5.6.39-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> select user();

+-------------------+

| user() |

+-------------------+

| root@minglinux-01 | //這里ip地址192.168.162.130被反解析到主機名minglinux-01

+-------------------+

1 row in set (0.00 sec)

查看當前使用的數(shù)據(jù)庫 select databsase()

mysql> select database();

+------------+

| database() |

+------------+

| NULL | //當前為NULL

+------------+

1 row in set (0.00 sec)

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> use mysql;

Database changed

mysql> select database();

+------------+

| database() |

+------------+

| mysql |

+------------+

1 row in set (0.00 sec)

創(chuàng)建庫 create database db1

mysql> create database db1;

Query OK, 1 row affected (0.00 sec)

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| db1 |

| mysql |

| performance_schema |

| test |

+--------------------+

5 rows in set (0.00 sec)

創(chuàng)建表 use db1; create table t1(id int(4), name char(40))

mysql> use db1;

Database changed

mysql> create table t1(`id` int(4), `name` char(40));

Query OK, 0 rows affected (0.01 sec)

mysql> show tables;

+---------------+

| Tables_in_db1 |

+---------------+

| t1 |

+---------------+

1 row in set (0.00 sec)

mysql> show create table t1\G;

*************************** 1. row ***************************

Table: t1

Create Table: CREATE TABLE `t1` (

`id` int(4) DEFAULT NULL,

`name` char(40) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1

1 row in set (0.00 sec)

ERROR:

No query specified

mysql> drop table t1;

Query OK, 0 rows affected (0.00 sec)

mysql> create table t1(`id` int(4),`name` char(40)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Query OK, 0 rows affected (0.01 sec)

mysql> show create table t1\G;

*************************** 1. row ***************************

Table: t1

Create Table: CREATE TABLE `t1` (

`id` int(4) DEFAULT NULL,

`name` char(40) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8 //字符集已改成utf8

1 row in set (0.00 sec)

ERROR:

No query specified

查看當前數(shù)據(jù)庫版本 select version()

mysql> select version();

+------------+

| version() |

+------------+

| 5.6.39-log |

+------------+

1 row in set (0.00 sec)

查看數(shù)據(jù)庫狀態(tài) show status

mysql> show status;

+-----------------------------------------------+-------------+

| Variable_name | Value |

+-----------------------------------------------+-------------+

| Aborted_clients | 0 |

| Aborted_connects | 2 |

| Binlog_cache_disk_use | 0 |

| Binlog_cache_use | 0 |

| Binlog_stmt_cache_disk_use | 0 |

| Binlog_stmt_cache_use | 4 |

| Bytes_received | 1246 |

| Bytes_sent | 22400 |

| Com_admin_commands | 0 |

| Com_assign_to_keycache | 0 |

| Com_alter_db | 0 |

| Com_alter_db_upgrade | 0 |

| Com_alter_event | 0 |

| Com_alter_function | 0 |

| Com_alter_procedure | 0 |

| Com_alter_server | 0 |

| Com_alter_table | 0 |

| Com_alter_tablespace | 0 |

| Com_alter_user | 0 |

| Com_analyze | 0 |

| Com_begin | 0 |

| Com_binlog | 0 |

| Com_call_procedure | 0 |

| Com_change_db | 3 |

···

···

+-----------------------------------------------+-------------+

341 rows in set (0.00 sec)

查看各參數(shù) show variables; show variables like 'max_connect%'

mysql> show variables; //這些參數(shù)均可以在my.cnf中定義

mysql> show variables like 'max_connect%'; //指定查看某個或某些參數(shù)

+--------------------+-------+

| Variable_name | Value |

+--------------------+-------+

| max_connect_errors | 100 |

| max_connections | 151 |

+--------------------+-------+

2 rows in set (0.00 sec)

mysql> show variables like 'slow%';

+---------------------+-----------------------------------+

| Variable_name | Value |

+---------------------+-----------------------------------+

| slow_launch_time | 2 |

| slow_query_log | OFF |

| slow_query_log_file | /data/mysql/minglinux-01-slow.log |

+---------------------+-----------------------------------+

3 rows in set (0.00 sec)

修改參數(shù) set global max_connect_errors=1000

mysql> set global max_connect_errors=1000;

Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'max_connect%';

+--------------------+-------+

| Variable_name | Value |

+--------------------+-------+

| max_connect_errors | 1000 |

| max_connections | 151 |

+--------------------+-------+

2 rows in set (0.00 sec)

修改參數(shù)的值在內(nèi)存中生效,重啟失效。在/etc/my.cnf文件中修改則永久有效

查看隊列 show processlist; show full processlist

mysql> show processlist;

+----+------+-----------+------+---------+------+-------+------------------+

| Id | User | Host | db | Command | Time | State | Info |

+----+------+-----------+------+---------+------+-------+------------------+

| 11 | root | localhost | NULL | Query | 0 | init | show processlist |

+----+------+-----------+------+---------+------+-------+------------------+

1 row in set (0.00 sec)

mysql> show full processlist;

+----+------+-----------+------+---------+------+-------+-----------------------+

| Id | User | Host | db | Command | Time | State | Info |

+----+------+-----------+------+---------+------+-------+-----------------------+

| 11 | root | localhost | NULL | Query | 0 | init | show full processlist |

+----+------+-----------+------+---------+------+-------+-----------------------+

1 row in set (0.00 sec)

使用show processlist顯示的最后一列(info)可能不完整,使用show full processlist會顯示完整

Mysql歷史命令記錄文件

[root@minglinux-01 ~] ls -a|grep mysql_history

.mysql_history

[root@minglinux-01 ~] cat .mysql_history

_HiStOrY_V2_

show\040database;

show\040databases;

use\040mysql;

select\040*\040from\040user;

show\040databases;

use\040mysql;

show\040tables;

desc\040user;

show\040create\040table\040user\134G;

select\040user();

select\040database();

use\040mysql

use\040mysql;

select\040database();

create\040database\040db1;

show\040databases;

use\040db1;

create\040table\040t1(`id`\040int(4),\040`name`\040char(40));

show\040tables;

show\040create\040table\040t1\134G;

drop\040table\040t1;

create\040table\040t1(`id`\040int(4),`name`\040char(40))\040ENGINE=InnoDB\040DEFAULT\040CHARSET=utf8;

show\040create\040table\040t1\134G;

select\040version();

show\040status;

show\040variables;

show\040variables\040like\040'max_connect%'

show\040variables\040like\040'max_connect%';

show\040variables\040like\040'slow%';

set\040global\040max_connect_errors=1000;\040

show\040variables\040like\040'max_connect%';

show\040processlist;

show\040full\040processlist;

擴展

總結(jié)

以上是生活随笔為你收集整理的mysql root命令_设置更改root密码、连接mysql、mysql常用命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。