首页 > 数据库 >Linux下Mysql数据库的基础操作

Linux下Mysql数据库的基础操作

时间:2023-04-18 20:37:13浏览次数:46  
标签:ci utf8 数据库 Linux general 2021 mysql Mysql NULL

(Linux下Mysql数据库的基础操作)

一、Mysql数据介绍

Mysql数据库是一种关系型数据库管理系统,具有的优点有体积小、速度快、总体成本低,开源,可移植性(跨平台,在不同系统中使用),可以和开发语结合,属于轻量级数据库。

二、数据库相关术语介绍

1.数据库相关名词

数据库: database  
表: table  
行: row  
列: column  
索引: index  
视图: view  
用户: user  
权限: privilege  
存储过程: procedure  
存储函数: function  
触发器: trigger  
事件调度器: event scheduler,任务计划

2.相关术语介绍

数据库中的表:表是一种结构化的文件,可用于存储特定类型的数据,表中的每一行,也称为一条记录。
数据库中的列:表中的一个字段,所有表都是由一个或多个列组成的。表中的每一列,称为属性,字段。
数据库中的索引: 将表中的一个或多个字段中的数据复制一份另存,并且按特定次序排序存储。
关系型数据库:关系数据库系统建立了关系模型,并用它来处理数据。关系模型在表中将信息与字段关联起来(也就是schemas),存储在数据表的行和列中。数据表可以彼此关联协作存储,也很容易提取数据。
非关系型数据库:非关系型数据不适合存储在数据表的行和列中,而是大块组合在一起。非关系型数据通常存储在数据集中,就像文档、键值对或者图结构。你的数据及其特性是选择数据存储和提取方式的首要影响因素。

三、Mysql数据库的管理

1.创建数据库用户

①创建用户

mysql> create user test@localhost identified by '123456';
Query OK, 0 rows affected (0.08 sec)

②授予用户权限

mysql> grant all privileges on *.* to test@localhost;
Query OK, 0 rows affected (0.10 sec)

③刷新权限缓存

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

④查看新建用户及登录

mysql> select user,host from mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
| test             | localhost |
+------------------+-----------+
5 rows in set (0.01 sec)

[root@control ~]# mysql -utest -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.13 Source distribution

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> 

2.查询用户状态

①查看单个用户权限

mysql> show grants for 'test'@'localhost';
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for test@localhost                                                                                                                                                                                                                                                                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `test`@`localhost` |
| GRANT BACKUP_ADMIN,BINLOG_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,GROUP_REPLICATION_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SET_USER_ID,SYSTEM_VARIABLES_ADMIN,XA_RECOVER_ADMIN ON *.* TO `test`@`localhost`                                                                                                  |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)


②查看单个用户是否存在

mysql> select user,host from mysql.user where user='test';
+------+-----------+
| user | host      |
+------+-----------+
| test | localhost |
+------+-----------+
1 row in set (0.00 sec)


③查询当前用户

mysql> select current_user;
+----------------+
| current_user   |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

3.修改密码及删除用户

①修改密码

mysql> alter user 'test'@'localhost' identified by 'admin';
Query OK, 0 rows affected (0.04 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

②删除数据库用户

mysql> 
mysql> drop user test@localhost;
Query OK, 0 rows affected (0.07 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

四、创建数据库及表

1.查看当前数据库列表

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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

2.显示指定数据库的表

mysql> use mysql;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| component                 |
| db                        |
| default_roles             |
| engine_cost               |
| func                      |
| general_log               |
| global_grants             |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| password_history          |
| plugin                    |
| procs_priv                |
| proxies_priv              |
| role_edges                |
| server_cost               |
| 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                      |
+---------------------------+
33 rows in set (0.01 sec)

3.显示数据表的详细信息

①显示mysql数据库中某个表信息

mysql> show  columns from server_cost;
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
| Field         | Type          | Null | Key | Default           | Extra                                         |
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
| cost_name     | varchar(64)   | NO   | PRI | NULL              |                                               |
| cost_value    | float         | YES  |     | NULL              |                                               |
| last_update   | timestamp     | NO   |     | CURRENT_TIMESTAMP | DEFAULT_GENERATED on update CURRENT_TIMESTAMP |
| comment       | varchar(1024) | YES  |     | NULL              |                                               |
| default_value | float         | YES  |     | NULL              | VIRTUAL GENERATED                             |
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
5 rows in set (0.00 sec)

②显示mysql数据库中所有表信息

mysql> SHOW TABLE STATUS  FROM mysql;
+---------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+---------------------------------------+-----------------------------------------+
| Name                      | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time         | Check_time | Collation          | Checksum | Create_options                        | Comment                                 |
+---------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+---------------------------------------+-----------------------------------------+
| columns_priv              | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Column privileges                       |
| component                 | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |              1 | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL |                                       | Components                              |
| db                        | InnoDB |      10 | Dynamic    |    2 |           8192 |       16384 |               0 |        16384 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Database privileges                     |
| default_roles             | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Default roles                           |
| engine_cost               | InnoDB |      10 | Dynamic    |    2 |           8192 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    |                                         |
| func                      | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | User defined functions                  |
| general_log               | CSV    |      10 | Dynamic    |    2 |              0 |           0 |               0 |            0 |         0 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL |                                       | General log                             |
| global_grants             | InnoDB |      10 | Dynamic    |   21 |            780 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | 2021-05-07 11:42:36 | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Extended global grants                  |
| gtid_executed             | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8mb4_0900_ai_ci |     NULL |                                       |                                         |
| help_category             | InnoDB |      10 | Dynamic    |   40 |            409 |       16384 |               0 |        16384 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | help categories                         |
| help_keyword              | InnoDB |      10 | Dynamic    |  658 |            149 |       98304 |               0 |        81920 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | help keywords                           |
| help_relation             | InnoDB |      10 | Dynamic    |  993 |             82 |       81920 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | keyword-topic relation                  |
| help_topic                | InnoDB |      10 | Dynamic    |  722 |           2201 |     1589248 |               0 |        81920 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | help topics                             |
| innodb_index_stats        | InnoDB |      10 | Dynamic    |   10 |           1638 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-22 16:47:16 | NULL                | NULL       | utf8_bin           |     NULL | row_format=DYNAMIC stats_persistent=0 |                                         |
| innodb_table_stats        | InnoDB |      10 | Dynamic    |    3 |           5461 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-22 16:47:16 | NULL                | NULL       | utf8_bin           |     NULL | row_format=DYNAMIC stats_persistent=0 |                                         |
| password_history          | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Password history for user accounts      |
| plugin                    | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | MySQL plugins                           |
| procs_priv                | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |        16384 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Procedure privileges                    |
| proxies_priv              | InnoDB |      10 | Dynamic    |    1 |          16384 |       16384 |               0 |        16384 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | User proxy privileges                   |
| role_edges                | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Role hierarchy and role grants          |
| server_cost               | InnoDB |      10 | Dynamic    |    6 |           2730 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    |                                         |
| servers                   | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | MySQL Foreign Servers table             |
| slave_master_info         | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Master Information                      |
| slave_relay_log_info      | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Relay Log Information                   |
| slave_worker_info         | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Worker Information                      |
| slow_log                  | CSV    |      10 | Dynamic    |    2 |              0 |           0 |               0 |            0 |         0 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL |                                       | Slow log                                |
| tables_priv               | InnoDB |      10 | Dynamic    |    2 |           8192 |       16384 |               0 |        16384 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Table privileges                        |
| time_zone                 | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |              1 | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Time zones                              |
| time_zone_leap_second     | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Leap seconds information for time zones |
| time_zone_name            | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Time zone names                         |
| time_zone_transition      | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Time zone transitions                   |
| time_zone_transition_type | InnoDB |      10 | Dynamic    |    0 |              0 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | NULL                | NULL       | utf8_general_ci    |     NULL | stats_persistent=0                    | Time zone transition types              |
| user                      | InnoDB |      10 | Dynamic    |    4 |           4096 |       16384 |               0 |            0 |   4194304 |           NULL | 2021-04-23 00:47:17 | 2021-05-07 11:42:36 | NULL       | utf8_bin           |     NULL | stats_persistent=0                    | Users and global privileges             |
+---------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+---------------------------------------+-----------------------------------------+
33 rows in set (0.01 sec)

4.创建数据库的表

①创建新数据库

mysql> create DATABASE huawei;
Query OK, 1 row affected (0.04 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| huawei             |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.01 sec)

常用创建数据方式为默认编码格式为utf8格式。

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.06 sec)

②创建用户表

mysql> create table student(id int auto_increment primary key,name varchar(16) not null,age int,sex char(1));
Query OK, 0 rows affected (0.07 sec)

③查看当前使用数据库

mysql> select database();
+------------+
| database() |
+------------+
| huawei     |
+------------+
1 row in set (0.00 sec)

④查看当前数据库的表

mysql> describe student;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(11)     | NO   | PRI | NULL    | auto_increment |
| name  | varchar(16) | NO   |     | NULL    |                |
| age   | int(11)     | YES  |     | NULL    |                |
| sex   | char(1)     | YES  |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

⑤查看字符集

mysql> show charset;
+----------+---------------------------------+---------------------+--------+
| Charset  | Description                     | Default collation   | Maxlen |
+----------+---------------------------------+---------------------+--------+
| armscii8 | ARMSCII-8 Armenian              | armscii8_general_ci |      1 |
| ascii    | US ASCII                        | ascii_general_ci    |      1 |
| big5     | Big5 Traditional Chinese        | big5_chinese_ci     |      2 |
| binary   | Binary pseudo charset           | binary              |      1 |
| cp1250   | Windows Central European        | cp1250_general_ci   |      1 |
| cp1251   | Windows Cyrillic                | cp1251_general_ci   |      1 |
| cp1256   | Windows Arabic                  | cp1256_general_ci   |      1 |
| cp1257   | Windows Baltic                  | cp1257_general_ci   |      1 |
| cp850    | DOS West European               | cp850_general_ci    |      1 |
| cp852    | DOS Central European            | cp852_general_ci    |      1 |
| cp866    | DOS Russian                     | cp866_general_ci    |      1 |
| cp932    | SJIS for Windows Japanese       | cp932_japanese_ci   |      2 |
| dec8     | DEC West European               | dec8_swedish_ci     |      1 |
| eucjpms  | UJIS for Windows Japanese       | eucjpms_japanese_ci |      3 |
| euckr    | EUC-KR Korean                   | euckr_korean_ci     |      2 |
| gb18030  | China National Standard GB18030 | gb18030_chinese_ci  |      4 |
| gb2312   | GB2312 Simplified Chinese       | gb2312_chinese_ci   |      2 |
| gbk      | GBK Simplified Chinese          | gbk_chinese_ci      |      2 |
| geostd8  | GEOSTD8 Georgian                | geostd8_general_ci  |      1 |
| greek    | ISO 8859-7 Greek                | greek_general_ci    |      1 |
| hebrew   | ISO 8859-8 Hebrew               | hebrew_general_ci   |      1 |
| hp8      | HP West European                | hp8_english_ci      |      1 |
| keybcs2  | DOS Kamenicky Czech-Slovak      | keybcs2_general_ci  |      1 |
| koi8r    | KOI8-R Relcom Russian           | koi8r_general_ci    |      1 |
| koi8u    | KOI8-U Ukrainian                | koi8u_general_ci    |      1 |
| latin1   | cp1252 West European            | latin1_swedish_ci   |      1 |
| latin2   | ISO 8859-2 Central European     | latin2_general_ci   |      1 |
| latin5   | ISO 8859-9 Turkish              | latin5_turkish_ci   |      1 |
| latin7   | ISO 8859-13 Baltic              | latin7_general_ci   |      1 |
| macce    | Mac Central European            | macce_general_ci    |      1 |
| macroman | Mac West European               | macroman_general_ci |      1 |
| sjis     | Shift-JIS Japanese              | sjis_japanese_ci    |      2 |
| swe7     | 7bit Swedish                    | swe7_swedish_ci     |      1 |
| tis620   | TIS620 Thai                     | tis620_thai_ci      |      1 |
| ucs2     | UCS-2 Unicode                   | ucs2_general_ci     |      2 |
| ujis     | EUC-JP Japanese                 | ujis_japanese_ci    |      3 |
| utf16    | UTF-16 Unicode                  | utf16_general_ci    |      4 |
| utf16le  | UTF-16LE Unicode                | utf16le_general_ci  |      4 |
| utf32    | UTF-32 Unicode                  | utf32_general_ci    |      4 |
| utf8     | UTF-8 Unicode                   | utf8_general_ci     |      3 |
| utf8mb4  | UTF-8 Unicode                   | utf8mb4_0900_ai_ci  |      4 |
+----------+---------------------------------+---------------------+--------+
41 rows in set (0.01 sec)


五、查询表其他相关信息

mysql> show create table student;
+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                                                                                                                        |
+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| student | CREATE TABLE `student` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(16) NOT NULL,
  `age` int(11) DEFAULT NULL,
  `sex` char(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)

mysql> show index from student;
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| Table   | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| student |          0 | PRIMARY  |            1 | id          | A         |           0 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
1 row in set (0.09 sec)

标签:ci,utf8,数据库,Linux,general,2021,mysql,Mysql,NULL
From: https://blog.51cto.com/u_14664141/6204026

相关文章

  • is blocked because of many connection errors; unblock with 'mysqladmin flush-hos
    指定允许连接不成功的最大尝试次数。5.7默认是100;如果到达这个数,那么服务器将不再允许新的连接,即便mysql仍正常对外提供服务。所以可以将这个参数设置为几万。showvariableslike'max_connect_errors';//最大链接错误次数可以提供最大的链接错误次数setglobalmax_conn......
  • 【Python毕业设计】基于Python+Flask+MySQL的学生信息管理系统(附完整源码)
    1、项目说明基于python+Flask+mysql的学生信息管理系统项目实战项目需要安装pycharm专业版,mysql数据库以及项目所需的所有模块创建数据库名称db_online_notes,然后执行sql文件生成数据表和数据项目需要安装flask,pymysql以及其他的一些模块安装命令如下:pipinstall-ihttps://......
  • Redis 一、(简介,redis-linux下载,启动方式,常用配置,应用场景,数据结构和内部编码,字符类型)
    目录Redis一、Redis1、简介2、RedisLinux下载安装3、redis启动方式3、1.简单启动3、2.动态参数启动3、3.配置文件启动5、常用配置6、redis应用场景7、redis通用命令8、数据结构和内部编码9、redis字符串类型Redis一、Redis1、简介#Redis特性1)速度快10wops(每秒10万......
  • 配置SUSE linux实例的NTP/Chrony时钟同步服务
    问题描述您希望了解如何修改Linux系统的ECS实例的时区,以及如何开启、配置及使用NTP/Chrony服务,保证实例的时间精确同步。适用于SUSELinuxEnterpriseforSAP12SUSELinuxEnterpriseforSAP15说明和使用限制NTP服务的通信端口为UDP123,您需要在实例安全组的入方向......
  • 55 openEuler搭建Mariadb数据库服务器-配置环境
    55openEuler搭建Mariadb数据库服务器-配置环境说明:以下环境配置仅为参考示例,具体配置视实际需求做配置。55.1关闭防火墙并取消开机自启动说明:测试环境下通常会关闭防火墙以避免部分网络因素影响,视实际需求做配置。在root权限下停止防火墙。#systemctlstopfirew......
  • Linux 防火墙命令
    一、Linux查看、关闭、打开防火墙命令以下截图中的操作均在Centos7上进行。1.查看防火墙状态的命令 systemctlstatusfirewalld  或者 firewall-cmd--state 2.关闭防火墙命令2.1暂时关闭防火墙(使用reboot命令重启后会恢复到原来的状态)systemctlstopfirewall......
  • 4月22日丨【云数据库技术沙龙】技术进化,让数据更智能
    4月22日,云数据库技术沙龙“MySQLxClickHouse”专场“MySQLxClickHouse”技术沙龙,本次沙龙以“技术进化,让数据更智能”为主题,汇聚字节跳动、阿里云、玖章算术、华为云、腾讯云、百度等众多数据库厂商的技术大咖,围绕MySQLxClickHouse的实践经验,与广大技术爱好者交流分享。2......
  • 开心档之MySQL 序列使用
     MySQL序列使用MySQL序列是一组整数:1,2,3,...,由于一张数据表只能有一个字段自增主键,如果你想实现其他字段也实现自动增加,就可以使用MySQL序列来实现。本章我们将介绍如何使用MySQL的序列。使用AUTO_INCREMENTMySQL中最简单使用序列的方法就是使用MySQLAUTO_......
  • 云原生之在kubernetes集群下部署Mysql应用
    (云原生之在kubernetes集群下部署mysql应用)一、Mysql介绍数据库(Database)是按照数据结构来组织、存储和管理数据的仓库。MySQL是一种开源的关系型数据库管理系统,可将数据保存在不同的表中,而不是将所有数据放在一个大的仓库内,从而加快了访问速度并提高了灵活性。MySQL使用了标准......
  • 【愚公系列】2023年04月 .NET CORE工具案例-DeveloperSharp的使用(数据库)
    (文章目录)前言DeveloperSharp是一个研发中大型项目必备的系统平台。也是一个低代码平台。它主要包括了如下一些功能:基于Sql语句、存储过程、事务、分页的数据库操作。并几乎支持市面上所有种类的数据库。图片操作。裁剪、缩放、加水印。http请求调用(Post与Get)高效分页We......