当前位置: 首页 > news >正文

mysql运维

1、msyqlLinux通用二进制安装

 1.  MySQL :: Download MySQL Community Server (Archived Versions)https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/下载8.0.28

 2.把二进制包放到Linux下

# 添加mysql组
$> groupadd mysql
# 增加mysql用户,把-g mysql组加到mysql用户中,-s 指定用户的登录shell,/bin/false创建没有服务器登录权限的用户 主机,-r 创建一个系统用户,系统用户的 UID 通常小于 1000。
$> useradd -r -g mysql -s /bin/false mysql
$> cd /usr/local
# 把mysql解压到这个目录下
$> tar xvf /path/to/mysql-VERSION-OS.tar.xz
# 创建硬链接mysql
$> ln -s full-path-to-mysql-VERSION-OS mysql
$> cd mysql
$> mkdir mysql-files
$> chown mysql:mysql mysql-files
$> chmod 750 mysql-files
# 初始化数据库
$> bin/mysqld --initialize --user=mysql
# 启动数据库服务端
$> bin/mysqld_safe --user=mysql &
# Next command is optional
$> cp support-files/mysql.server /etc/init.d/mysql.server

 初始化数据库时可能会出现问题

是因为找不到 libaio.so.1这个库

查看系统是否有libaio.so 但不是 libaio.so.1 

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# ldconfig -p | grep libaiolibaio.so.1t64 (libc6,x86-64) => /lib/x86_64-linux-gnu/libaio.so.1t64libaio.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libaio.so

 查看libaio.so位置

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# find /usr -name libaio.so*
/usr/lib/x86_64-linux-gnu/libaio.so.1t64.0.2
/usr/lib/x86_64-linux-gnu/libaio.so.1t64
/usr/lib/x86_64-linux-gnu/libaio.so

创建硬链接链接到libaio.so.1 

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64.0.2 /usr/lib/x86_64-linux-gnu/libaio.so.1

再次初始化就没问题了,后面他会给你个root的临时密码

2025-01-23T08:37:26.842753Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.28-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.28) initializing of server in progress as process 14334
2025-01-23T08:37:26.897078Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-01-23T08:37:27.685107Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-01-23T08:37:29.432879Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: t8g,pkplN4YI

启动后用mysql客户端连接测试一下

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# bin/mysql -u root -p
bin/mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

是缺少 libtinfo.so.5原因

查找一下有没有这个库

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# ldconfig -p | grep libtinfolibtinfo.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtinfo.so.6

 发现libtinfo.so.6但没有 libtinfo.so.5

也可以用6代替5

找到6库位置

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# find /usr -name libtinfo.so*
/usr/lib/x86_64-linux-gnu/libtinfo.so.6.5
/usr/lib/x86_64-linux-gnu/libtinfo.so.6
root@hwz-VMware-Virtual-Platform:/usr/local/mysql# ln -n /usr/lib/x86_64-linux-gnu/libtinfo.so.6.5 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

 使用初始密码登录成功

root@hwz-VMware-Virtual-Platform:/usr/local/mysql# bin/mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.28Copyright (c) 2000, 2022, Oracle and/or its affiliates.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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> 

他要你改密码后才能操作

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';

这时应该可以正常操作数据库了。 

额外的配置

 为了可以直接使用mysql命令,不用到/usr/local/mysql/bin找命令,可以mysql的命令添加到环境变量中

vim ~/.bashrc# 在文件最后加上export PATH=$PATH:/usr/local/mysql/binsource ~/.bashrc

使用systemctl管理MySQL服务 

在/etc/systemd/system/mysql.service写入下面配置

[Unit]
Description=MySQL Server
After=network.target[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my.cnf
ExecStop=/usr/local/mysql/bin/mysqladmin shutdown
Restart=on-failure[Install]
WantedBy=multi-user.target

 systemctl配置文件更改需要使用命令刷新一下配置

systemctl daemon-reload

配置文件/etc/mysql/my.cnf

[client]
user=root
password=xxx    # 配置了这个默认登录root不用输入密码[mysql]
prompt=(\\u@\\h) [\\d]>\\_    # 更改MySQL客户端命令>前面显示内容[mysqld]
port=3306
user=mysql
datadir=/usr/local/mysql/data
log_error=error.log

如果之前开启过MySQL需要使用命令mysqladmin shutdown关闭 MySQL

 查看mysql进程是否存在

root@hwz-VMware-Virtual-Platform:/etc/mysql# ps -ef | grep mysql
mysql      18982       1  0 21:22 ?        00:00:05 /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my.cnf
root       19061    3897  0 21:39 pts/2    00:00:00 grep --color=auto mysql
systemctl start mysql # 启动MySQL
systemctl stop mysql # 关闭MySQL
systemctl status mysql # 查看MySQL服务状态

额外注意点

1.启动时如果不特定指定配置文件位置,MySQL启动时会按这几个配置文件顺序读取/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

root@hwz-VMware-Virtual-Platform:~# mysql --help | grep my.cnforder of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

后面的配置文件配置会覆盖前面的配置文件配置 

一般配置文件都放在/etc/下,然而/etc/mysql/my.cnf可读性好点,所以推荐放在/etc/mysql/my.cnf

2.前面配置systemctl配置时启动命令为啥不用mysqld_safe而是用mysqld来启动MySQL?

因为mysqld_safe是一个守护进程 

 这里我使用mysqld_safe启动MySQL会发现它其实是启动了两个进程,一个是mysqld_safe,一个是mysqld,本质还是用mysqld启动MySQL,mysqld_safe是用来监视mysqld的,mysqld挂掉了会自动启动,这里可以使用kill -9 掉mysqld来测试。

root@hwz-VMware-Virtual-Platform:/etc/mysql# mysqld_safe --user=mysql &
[1] 19086
root@hwz-VMware-Virtual-Platform:/etc/mysql# 2025-01-25T13:46:08.647339Z mysqld_safe Logging to '/usr/local/mysql/data/error.log'.
2025-01-25T13:46:08.700221Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/dataroot@hwz-VMware-Virtual-Platform:/etc/mysql# ps -ef | grep mysql
root       19086    3897  0 21:46 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql
mysql      19210   19086 15 21:46 pts/2    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysq --log-error=error.log --pid-file=hwz-VMware-Virtual-Platform.pid --port=3306
root       19258    3897  0 21:46 pts/2    00:00:00 grep --color=auto mysql

systemctl本身可以配置 守护进程,自然不需要mysqld_safe

1.1 忘记root密码

忘记root密码怎么修改root密码?

原理:跳过连接层的验证用户功能 ,不让mysql启动加载授权表

1.停掉mysql

root@hwz-VMware-Virtual-Platform:~# systemctl stop mysql

2.使用mysqld_safe加关闭授权功能参数启动MySQL ,关闭tcp/ip连接,然后随便一个写个用户都可以登录上

root@hwz-VMware-Virtual-Platform:~# mysqld_safe --skip-grant-tables --skip-networking &
[1] 4150
root@hwz-VMware-Virtual-Platform:~# 2025-02-03T04:12:03.405924Z mysqld_safe Logging to '/usr/local/mysql/data/error.log'.
2025-02-03T04:12:03.459742Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/dataroot@hwz-VMware-Virtual-Platform:~# mysql -uxxxxx -pxxxxx
mysql: [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: 8.0.28 MySQL Community Server - GPLCopyright (c) 2000, 2022, Oracle and/or its affiliates.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.(xxxxx@localhost) [(none)]> 

3.加载授权表(启动时跳过加载授权表,但是修改密码需要授权表,所以启动后加载授权表)

(xxxxx@localhost) [(none)]> flush privileges;
Query OK, 0 rows affected (0.02 sec)

3.修改root用户密码

(xxxxx@localhost) [(none)]> alter user root@'localhost' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

 4.重启MySQL

先关闭mysql_safe方式启动

root@hwz-VMware-Virtual-Platform:~# mysqladmin -uroot -p123456 shutdown
root@hwz-VMware-Virtual-Platform:~# systemctl restart mysql

1.2 ssl客户端加密连接

 8.0版本默认开启ssl,have_openssl、have_ssl都为yes

(root@localhost) [mysql]> show variables like '%ssl%';
+-------------------------------------+-----------------+
| Variable_name                       | Value           |
+-------------------------------------+-----------------+
| admin_ssl_ca                        |                 |
| admin_ssl_capath                    |                 |
| admin_ssl_cert                      |                 |
| admin_ssl_cipher                    |                 |
| admin_ssl_crl                       |                 |
| admin_ssl_crlpath                   |                 |
| admin_ssl_key                       |                 |
| have_openssl                        | YES             |
| have_ssl                            | YES             |
| mysqlx_ssl_ca                       |                 |
| mysqlx_ssl_capath                   |                 |
| mysqlx_ssl_cert                     |                 |
| mysqlx_ssl_cipher                   |                 |
| mysqlx_ssl_crl                      |                 |
| mysqlx_ssl_crlpath                  |                 |
| mysqlx_ssl_key                      |                 |
| performance_schema_show_processlist | OFF             |
| ssl_ca                              | ca.pem          |
| ssl_capath                          |                 |
| ssl_cert                            | server-cert.pem |
| ssl_cipher                          |                 |
| ssl_crl                             |                 |
| ssl_crlpath                         |                 |
| ssl_fips_mode                       | OFF             |
| ssl_key                             | server-key.pem  |
+-------------------------------------+-----------------+
25 rows in set (0.01 sec)

 默认已经生成SSL 证书和密钥在数据目录下

用户可以手动调用 mysql_ssl_rsa_setup 实用程序(从 MySQL 8.0.34 开始已弃用),之后版本数据库启动时如果SSL 证书和密钥不存在则自动生成。

如果存在这些文件中的任何一个,mysql_ssl_rsa_setup 不会创建 SSL 文件。

ca.pem 自签名 CA 证书
ca-key.pem CA 私有密钥
server-cert.pem 服务器证书
server-key.pem 服务器私钥
client-cert.pem 客户端证书
client-key.pem 客户端私钥

 RSA 文件 

private_key.pem      私钥.pem 文件,私钥/公钥对的私有成员
public_key.pem       公共成员,属于私钥/公钥对

1.2.1 win客户端navicat ssl加密连接上数据库

 1.关闭mysql所在服务器防火窗或者开放3306端口

2.添加一个外网段可以访问mysql的用户

这个ip是我Navicat所在机器ip

(root@localhost) [mysql]> create user root@'172.20.10.1' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

创建用户必须要ssl加密才能登录

(root@localhost) [mysql]> create user root@'172.20.10.1' identified by '123456' REQUIRE X509;
Query OK, 0 rows affected (0.01 sec)

 或者SET PERSIST require_secure_transport=ON;设置所以客户端连接都需要ssl

连接上了但只看到一个数据库说明没有权限

3。授予权限给这个用户

(root@localhost) [mysql]> grant all on *.* to root@'172.20.10.1';
Query OK, 0 rows affected (0.01 sec)

重新连接就显示全部数据库了

4.使用ssl方式连接

 拿出client-cert.pem 客户端证书 client-key.pem 客户端私钥到客户端机器那边。

 

 验证当前连接是否使用了ssl加密连接,不为空则是使用了ssl加密连接

SHOW SESSION STATUS LIKE 'Ssl_cipher';

2.MySQL的配置参数

查看某个参数可用通配符 

show variables like 'data%';

 变量可分为

  • 按作用范围分(不标明默认是会话变量)
    • session会话变量(只影响当前会话)
    • global全局变量(影响所有会话)
(root@localhost) [(none)]> set session long_query_time=2-> ;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [(none)]> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 2.000000 |
+-----------------+----------+
1 row in set (0.01 sec)(root@localhost) [(none)]> set long_query_time=4;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [(none)]> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 4.000000 |
+-----------------+----------+
1 row in set (0.00 sec)(root@localhost) [(none)]> set global long_query_time=6;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [(none)]> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 4.000000 |
+-----------------+----------+
1 row in set (0.00 sec)
(root@localhost) [(none)]> set global long_query_time=6;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [(none)]> show variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 4.000000 |
+-----------------+----------+
1 row in set (0.00 sec)(root@localhost) [(none)]> set global long_query_time=8;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [(none)]> show global variables like 'long_query_time';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| long_query_time | 8.000000 |
+-----------------+----------+
1 row in set (0.01 sec)

 需要注意的是一个会话set global后,有另外一个会话在set global前打开的这个会话,那直接show variables是不会读取到set global后的值的,show global variables可以读取到,你需要重新打开这个会话show variables才会读取到set global后的值。

查看其他会话的变量值

(root@localhost) [performance_schema]> show tables like '%variables%';
+--------------------------------------------+
| Tables_in_performance_schema (%variables%) |
+--------------------------------------------+
| global_variables                           |
| persisted_variables                        |
| session_variables                          |
| user_variables_by_thread                   |
| variables_by_thread                        |
| variables_info                             |
+--------------------------------------------+
6 rows in set (0.00 sec)(root@localhost) [performance_schema]> select * from variables_by_thread where VARIABLE_NAME='long_query_time';
+-----------+-----------------+----------------+
| THREAD_ID | VARIABLE_NAME   | VARIABLE_VALUE |
+-----------+-----------------+----------------+
|        47 | long_query_time | 10.000000      |
|        48 | long_query_time | 8.000000       |
+-----------+-----------------+----------------+
2 rows in set (0.00 sec)

这里可以看到一个是10是我当前会话的 long_query_time的值,另外一个8是另外一个会话设置的值

  • 按类型分
    • 可修改变量
    • 只读变量(mysql运行中不能修改这种变量比如datadir变量)

MySQL :: MySQL 8.0 参考手册 :: 7.1.8 服务器系统变量

可以查看参数是否是可修改的变量,Dynamic为yes的变量可修改

3.用户权限管理

创建用户

create user 'hwz'@'192.168.1.%' identified by '123456';

 删除用户

drop user 'hwz'@'192.168.1.%';

修改用户密码

(root@localhost) [mysql]> alter user 'hwz'@'localhost' identified by '1234';
Query OK, 0 rows affected (0.01 sec)

查看创建的用户 

(root@localhost) [mysql]> show create user 'hwz'@'localhost'\G
*************************** 1. row ***************************
CREATE USER for hwz@localhost: CREATE USER `hwz`@`localhost` IDENTIFIED WITH 'caching_sha2_password' AS '$A$005$\\F]4\\L~dQ>A\n\'MP~wsWQWtSMTdbwDCdYV0qIKuWUr.2DKpaWruXUVBb3CSlA' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT

用户上锁

(root@localhost) [(none)]> alter user hwz@'localhost' account lock;
Query OK, 0 rows affected (0.01 sec)(root@localhost) [(none)]> select user,host,account_locked from mysql.user;
+------------------+-------------+----------------+
| user             | host        | account_locked |
+------------------+-------------+----------------+
| hwz              | 192.168.1.% | N              |
| hwz              | localhost   | Y              |
| mysql.infoschema | localhost   | Y              |
| mysql.session    | localhost   | Y              |
| mysql.sys        | localhost   | Y              |
| root             | localhost   | N              |
+------------------+-------------+----------------+
6 rows in set (0.00 sec)

 用户解锁

(root@localhost) [(none)]> alter user hwz@'localhost' account unlock;
Query OK, 0 rows affected (0.00 sec)

查看所有的用户

(root@localhost) [mysql]> select host,user from user;
+-------------+------------------+
| host        | user             |
+-------------+------------------+
| 192.168.1.% | hwz              |
| localhost   | hwz              |
| localhost   | mysql.infoschema |
| localhost   | mysql.session    |
| localhost   | mysql.sys        |
| localhost   | root             |
+-------------+------------------+
6 rows in set (0.00 sec)

授予权限 

语法:grant 权限 on 权限级别 to 用户;

权限级别有四种:

  • *.*  :                       全库级别      ----->管理员    --->mysql.user
  • test.*:                  单库级别      ----->业务层面   ------>mysql.db
  • test.t1:                单表级别                                ------->mysql.tables_priv
  • select(id,name) : 列级别                                  --------->mysql.columns_priv
# 授予权限前不能看到mysql数据库
(hwz@localhost) [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+# 使用root账号授权给hwz账号查看mysql数据库所有表的权限
(root@localhost) [mysql]> grant select on mysql.* to 'hwz'@'localhost';
Query OK, 0 rows affected (0.01 sec)# 授予权限后
(hwz@localhost) [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+

授予权限同时授予他的权限授予别人

(root@localhost) [mysql]> grant select,insert on mysql.* to 'hwz'@'localhost' with grant option; 
Query OK, 0 rows affected (0.01 sec)(root@localhost) [mysql]> show grants for 'hwz'@'localhost';
+--------------------------------------------------------------------------+
| Grants for hwz@localhost                                                 |
+--------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `hwz`@`localhost`                                  |
| GRANT SELECT, INSERT ON `mysql`.* TO `hwz`@`localhost` WITH GRANT OPTION |
+--------------------------------------------------------------------------+
2 rows in set (0.00 sec)

查看当前用户权限

(hwz@localhost) [(none)]> show grants;
+-----------------------------------------+
| Grants for hwz@localhost                |
+-----------------------------------------+
| GRANT USAGE ON *.* TO `hwz`@`localhost` |
+-----------------------------------------+

 查看别的用户权限

(root@localhost) [mysql]> show grants for 'hwz'@'localhost';
+-----------------------------------------+
| Grants for hwz@localhost                |
+-----------------------------------------+
| GRANT USAGE ON *.* TO `hwz`@`localhost` |
+-----------------------------------------+

通过权限表查看用户权限

# 这里授权hwz用户能只能查询test库的user表的name字段
(root@localhost) [test]> grant select(name) on test.user to hwz@'localhost';
Query OK, 0 rows affected (0.01 sec)# 可以通过查询mysql.columns_priv查询到该权限,第三个即是
(root@localhost) [mysql]> select * from mysql.columns_priv where user='hwz'\G
*************************** 1. row ***************************Host: localhostDb: mysqlUser: hwzTable_name: user
Column_name: hostTimestamp: 2025-01-28 22:35:17
Column_priv: Select
*************************** 2. row ***************************Host: localhostDb: mysqlUser: hwzTable_name: user
Column_name: userTimestamp: 2025-01-28 22:35:17
Column_priv: Select
*************************** 3. row ***************************Host: localhostDb: testUser: hwzTable_name: user
Column_name: nameTimestamp: 2025-02-03 15:51:27
Column_priv: Select
3 rows in set (0.00 sec)

 刚创建的用户只有USAGE权限,相当于没有权限,只能登录

MySQL :: MySQL 8.0 参考手册 :: MySQL 提供的 8.2.2 权限 查看所有详细的权限和说明

查看有哪些权限

(root@localhost) [(none)]> show privileges;

 收回权限

(root@localhost) [mysql]> revoke select on mysql.* from 'hwz'@'localhost';
Query OK, 0 rows affected (0.01 sec)(root@localhost) [mysql]> show grants for 'hwz'@'localhost';
+-----------------------------------------+
| Grants for hwz@localhost                |
+-----------------------------------------+
| GRANT USAGE ON *.* TO `hwz`@`localhost` |
+-----------------------------------------+

3.1 角色创建和授权

8.0后社区版本才有角色授权

(root@localhost) [mysql]> create role dev_role@'localhost';
Query OK, 0 rows affected (0.02 sec)(root@localhost) [mysql]> grant select,update,insert on test.* to dev_role@'localhost';
Query OK, 0 rows affected (0.00 sec)(root@localhost) [mysql]> create user dev_user@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)(root@localhost) [mysql]> grant dev_role@'localhost' to dev_user@'localhost';
Query OK, 0 rows affected (0.01 sec)

查看角色

(root@localhost) [mysql]> select * from mysql.role_edges;
+-----------+-----------+-----------+----------+-------------------+
| FROM_HOST | FROM_USER | TO_HOST   | TO_USER  | WITH_ADMIN_OPTION |
+-----------+-----------+-----------+----------+-------------------+
| localhost | dev_role  | localhost | dev_user | N                 |
+-----------+-----------+-----------+----------+-------------------+
1 row in set (0.00 sec)

 角色也相当于一个上锁的用户(不能登陆)

(root@localhost) [mysql]> select user,host,authentication_string,account_locked from mysql.user\G
*************************** 2. row ***************************user: dev_rolehost: localhost
authentication_string: account_locked: Y

还可以这样查询用户权限

(root@localhost) [mysql]> select * from information_schema.user_privileges;

3.2 激活角色 

向角色授予权限后默认是没有激活角色的。

登录上被授予角色的用户查看当前会话激活的角色,NONE即是没有。

(dev_user2@localhost) [test]> SELECT CURRENT_ROLE();
+----------------+
| CURRENT_ROLE() |
+----------------+
| NONE           |
+----------------+
1 row in set (0.00 sec)

有三种方法激活角色

1. 设置默认激活的角色。当用户登录上时会自动激活默认角色。

设置默认将所有的授予的角色激活 

(root@localhost) [mysql]> set default role all to dev_user2@'localhost';
Query OK, 0 rows affected (0.01 sec)

我这里授予了两个角色,所以默认有两个,你也可以默认激活指定一个

(dev_user2@localhost) [(none)]> SELECT CURRENT_ROLE();
+---------------------------------+
| CURRENT_ROLE()                  |
+---------------------------------+
| `dev_role2`@`%`,`dev_role3`@`%` |
+---------------------------------+
1 row in set (0.00 sec)

2.当前会话手动激活指定角色。

(dev_user2@localhost) [(none)]> set role dev_role3;
Query OK, 0 rows affected (0.00 sec)(dev_user2@localhost) [(none)]> SELECT CURRENT_ROLE();
+-----------------+
| CURRENT_ROLE()  |
+-----------------+
| `dev_role3`@`%` |
+-----------------+
1 row in set (0.00 sec)

还有种方式激活所有排查指定角色 

(dev_user2@localhost) [(none)]> set role all except dev_role3;
Query OK, 0 rows affected (0.01 sec)(dev_user2@localhost) [(none)]> SELECT CURRENT_ROLE();
+-----------------+
| CURRENT_ROLE()  |
+-----------------+
| `dev_role2`@`%` |
+-----------------+
1 row in set (0.00 sec)

3.开启系统参数activate-all-roles-on-login登录自动激活所有授予的角色。

(root@localhost) [mysql]> show variables like 'activate_all_roles_on_login';
+-----------------------------+-------+
| Variable_name               | Value |
+-----------------------------+-------+
| activate_all_roles_on_login | OFF   |
+-----------------------------+-------+
1 row in set (0.01 sec)(root@localhost) [mysql]> SET GLOBAL activate_all_roles_on_login=ON;
Query OK, 0 rows affected (0.00 sec)(root@localhost) [mysql]> show variables like 'activate_all_roles_on_login';
+-----------------------------+-------+
| Variable_name               | Value |
+-----------------------------+-------+
| activate_all_roles_on_login | ON    |
+-----------------------------+-------+
1 row in set (0.00 sec)

3.3 回收角色

(root@localhost) [mysql]> show grants for hwz@'localhost';
+----------------------------------------------------------------------+
| Grants for hwz@localhost                                             |
+----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `hwz`@`localhost`                              |
| GRANT INDEX ON `mysql`.* TO `hwz`@`localhost`                        |
| GRANT SELECT (`host`, `user`) ON `mysql`.`user` TO `hwz`@`localhost` |
| GRANT SELECT (`name`) ON `test`.`user` TO `hwz`@`localhost`          |
| GRANT `dev_role2`@`%` TO `hwz`@`localhost`                           |
+----------------------------------------------------------------------+
5 rows in set (0.00 sec)(root@localhost) [mysql]> revoke dev_role2 from hwz@'localhost';
Query OK, 0 rows affected (0.00 sec)

4、

常用命令 

1、linux命令 

查看某参数的默认值或者官方解释
mysqld --help --verbose | grep defaults-file

2、SQL命令 

 查找某个配置变量的值

(root@localhost) [(none)]> show variables like 'data%';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| datadir       | /usr/local/mysql/data/ |
+---------------+------------------------+
1 row in set (0.01 sec)

查看告警

show warnings;

查看表结构

desc table_name;

查看当前连接服务端的状态

(root@localhost) [mysql]> status
--------------
mysql  Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)Connection id:		8
Current database:	mysql
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		8.0.28 MySQL Community Server - GPL
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/tmp/mysql.sock
Binary data as:		Hexadecimal
Uptime:			8 hours 44 min 31 secThreads: 3  Questions: 235  Slow queries: 0  Opens: 260  Flush tables: 3  Open tables: 179  Queries per second avg: 0.007
--------------(root@localhost) [mysql]> \s
--------------
mysql  Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)Connection id:		8
Current database:	mysql
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		8.0.28 MySQL Community Server - GPL
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/tmp/mysql.sock
Binary data as:		Hexadecimal
Uptime:			8 hours 44 min 38 secThreads: 3  Questions: 238  Slow queries: 0  Opens: 260  Flush tables: 3  Open tables: 179  Queries per second avg: 0.007
--------------

 查看是否开启ssl连接,主要看have_openssl为yes即为开启(8.x版本默认开启)

(root@localhost) [mysql]> show variables like '%ssl%';
+-------------------------------------+-----------------+
| Variable_name                       | Value           |
+-------------------------------------+-----------------+
| admin_ssl_ca                        |                 |
| admin_ssl_capath                    |                 |
| admin_ssl_cert                      |                 |
| admin_ssl_cipher                    |                 |
| admin_ssl_crl                       |                 |
| admin_ssl_crlpath                   |                 |
| admin_ssl_key                       |                 |
| have_openssl                        | YES             |
| have_ssl                            | YES             |
| mysqlx_ssl_ca                       |                 |
| mysqlx_ssl_capath                   |                 |
| mysqlx_ssl_cert                     |                 |
| mysqlx_ssl_cipher                   |                 |
| mysqlx_ssl_crl                      |                 |
| mysqlx_ssl_crlpath                  |                 |
| mysqlx_ssl_key                      |                 |
| performance_schema_show_processlist | OFF             |
| ssl_ca                              | ca.pem          |
| ssl_capath                          |                 |
| ssl_cert                            | server-cert.pem |
| ssl_cipher                          |                 |
| ssl_crl                             |                 |
| ssl_crlpath                         |                 |
| ssl_fips_mode                       | OFF             |
| ssl_key                             | server-key.pem  |
+-------------------------------------+-----------------+

查看前台连接线程

(root@localhost) [(none)]> show processList;
+----+-----------------+-----------+------+---------+------+------------------------+------------------+
| Id | User            | Host      | db   | Command | Time | State                  | Info             |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+
|  5 | event_scheduler | localhost | NULL | Daemon  |  131 | Waiting on empty queue | NULL             |
|  8 | root            | localhost | NULL | Query   |    0 | init                   | show processList |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+
2 rows in set (0.00 sec)

 查看后台在执行的线程(像io线程,SQL线程。。。。)

(root@localhost) [(none)]> select * from performance_schema.threads\G
*************************** 1. row ***************************THREAD_ID: 1NAME: thread/sql/mainTYPE: BACKGROUNDPROCESSLIST_ID: NULLPROCESSLIST_USER: NULLPROCESSLIST_HOST: NULLPROCESSLIST_DB: mysql
PROCESSLIST_COMMAND: NULLPROCESSLIST_TIME: 565PROCESSLIST_STATE: NULLPROCESSLIST_INFO: NULLPARENT_THREAD_ID: NULLROLE: NULLINSTRUMENTED: YESHISTORY: YESCONNECTION_TYPE: NULLTHREAD_OS_ID: 4620RESOURCE_GROUP: SYS_default
*************************** 2. row ***************************THREAD_ID: 3NAME: thread/innodb/io_ibuf_threadTYPE: BACKGROUNDPROCESSLIST_ID: NULLPROCESSLIST_USER: NULLPROCESSLIST_HOST: NULLPROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: NULLPROCESSLIST_TIME: NULLPROCESSLIST_STATE: NULLPROCESSLIST_INFO: NULLPARENT_THREAD_ID: NULLROLE: NULLINSTRUMENTED: YESHISTORY: YESCONNECTION_TYPE: NULLTHREAD_OS_ID: 4625RESOURCE_GROUP: SYS_default

相关文章:

mysql运维

1、msyqlLinux通用二进制安装 1. MySQL :: Download MySQL Community Server (Archived Versions)https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql.com/archives/community/https://downloads.mysql…...

将Deepseek接入pycharm 进行AI编程

目录 专栏导读1、进入Deepseek开放平台创建 API key 2、调用 API代码 3、成功4、补充说明多轮对话 总结 专栏导读 🌸 欢迎来到Python办公自动化专栏—Python处理办公问题,解放您的双手 🏳️‍🌈 博客主页:请点击——…...

Redis03 - 高可用

Redis高可用 文章目录 Redis高可用一:主从复制 & 读写分离1:主从复制的作用2:主从复制原理2.1:全量复制2.2:增量复制(环形缓冲区) 3:主从复制实际演示3.1:基本流程准…...

日常知识点之面试后反思遗留问题汇总

梳理一下最近接触到的几个知识点: 1:突然问到端口复用 (SO_REUSEADDR) 端口复用一般用在服务端重启时,套接字处于time_wait状态时,无法绑定该端口,导致无法启动问题。 设置端口复用&#xff…...

软考教材重点内容 信息安全工程师 第15章 网络安全主动防御技术与应用

目录 15.1.1 人侵阻断技术原理 15.1.2 人侵阻断技术应用 15.3 网络流量清洗技术与应用 15.3.1 网络流量清洗技术原理 15.3.2 网络流量清洗技术应用 15.4 可信计算技术与应用 15.4.1 可信计算技术原理 15.5 数字水印技术与应用 15.5.1 数字水印技术原理 15.5.2 数字水…...

大模型的底层逻辑及Transformer架构

一、大模型的底层逻辑 1.数据驱动 大模型依赖海量的数据进行训练,数据的质量和数量直接影响模型的性能。通过大量的数据,模型能够学习到丰富的模式和规律,从而更好地处理各种任务。 2.深度学习架构 大模型基于深度学习技术,通常采用多层神经网络进行特征学习与抽象。其中…...

PostgreSQL-字符串函数

字符串连接 SELECT A||B; 字符串连接,适用于字符串与数字连接 SELECT CONCAT(10,a,hello,20.0); 连接所有参数,个数不限,类型不限 字母转换 SELECT LOWER(ABCD); 将字符转换成小写 SELECT UPPER(ABCD); 将字符转换成大写 SELECT IN…...

Qt修仙之路2-1 炼丹初成

widget.cpp #include "widget.h" #include<QDebug> //实现槽函数 void Widget::login1() {QString userusername_input->text();QString passpassword_input->text();//如果不勾选无法登入if(!check->isChecked()){qDebug()<<"xxx"&…...

华为的IPD模式VS敏捷项目管理模式

本文介绍了华为的IPD模式与敏捷项目管理模式的对比。文章详细阐述了两种模式的特点、适用范围及实施要点&#xff0c;为读者提供了全面的理解。 重点内容&#xff1a; 1. IPD模式强调跨部门协同&#xff0c;注重产品全生命周期管理&#xff0c;适用于复杂产品领域。 2. 敏捷…...

Ollama python交互:chat+embedding实践

Ollama简介 Ollama 是一个开源的大型语言模型&#xff08;LLM&#xff09;平台&#xff0c;旨在让用户能够轻松地在本地运行、管理和与大型语言模型进行交互。 Ollama 提供了一个简单的方式来加载和使用各种预训练的语言模型&#xff0c;支持文本生成、翻译、代码编写、问答等…...

Redis进阶

Redis持久化&#xff1a; 前面我们讲到mysql事务有四个比较核心的特性&#xff1a; 原子性&#xff1a;保证多个操作打包成一个。一致性&#xff1a;A给B100&#xff0c;A少一百&#xff0c;B必须多一百。持久性&#xff1a;针对事务操作必须要持久生效&#xff0c;不管是重启…...

【蓝桥杯嵌入式】6_定时器输入捕获

全部代码网盘自取 链接&#xff1a;https://pan.baidu.com/s/1PX2NCQxnADxYBQx5CsOgPA?pwd3ii2 提取码&#xff1a;3ii2 这是两个信号发生器&#xff0c;可以通过调节板上的两个电位器R39和R40调节输出频率。 将PB4、PA15选择ch1&#xff0c;两个信号发生器只能选择TIM3和TIM…...

C#常用集合优缺点对比

先上结论&#xff1a; 在C#中&#xff0c;链表、一维数组、字典、List<T>和ArrayList是常见的数据集合类型&#xff0c;它们各有优缺点&#xff0c;适用于不同的场景。以下是它们的比较&#xff1a; 1. 一维数组 (T[]) 优点&#xff1a; 性能高&#xff1a;数组在内存中…...

Python调取本地MongoDB招投标数据库,并结合Ollama部署的DeepSeek-R1-8B模型来制作招投标垂直领域模型

根据你的需求&#xff0c;以下是使用Python调取本地MongoDB招投标数据库&#xff0c;并结合Ollama部署的DeepSeek-R1-8B模型来制作招投标垂直领域模型的步骤&#xff1a; 安装PyMongo 首先&#xff0c;确保你已经安装了PyMongo库&#xff0c;用于Python与MongoDB的交互。如果未…...

【MySQL】深入了解索引背后的内部结构

目录 索引的认识&#xff1a; 作用&#xff1a; 索引的使用&#xff1a; 索引底层的数据结构&#xff1a; 哈希表 AVL树 红黑树 B树&#xff1a; B树&#xff1a; B树搜索&#xff1a; 索引的认识&#xff1a; 索引是数据库中的一个数据结构&#xff0c;用于加速查询…...

pytest-xdist 进行多进程并发测试

在自动化测试中&#xff0c;运行时间过长往往是令人头疼的问题。你是否遇到过执行 Pytest 测试用例时&#xff0c;整个测试流程缓慢得让人抓狂&#xff1f;别担心&#xff0c;pytest-xdist 正是解决这一问题的利器&#xff01;它支持多进程并发执行&#xff0c;能够显著加快测试…...

蓝桥杯准备 【入门3】循环结构

素数小算法&#xff08;埃氏筛&&欧拉筛&#xff09; 以下四段代码都是求20以内的所有素数 1.0版求素数 #include<iostream> using namespace std;int main() {int n 20;for(int i2;i<n;i){int j0;for(j2;j<i;j)//遍历i{if(i%j0){break;}}if(ij){cout&l…...

PHP填表统计预约打卡表单系统小程序

&#x1f4cb; 填表统计预约打卡表单系统——专属定制&#xff0c;信息互动新纪元 &#x1f4ca; 填表统计预约打卡表单系统&#xff0c;一款专为现代快节奏生活量身打造的多元化自定义表单统计小程序&#xff0c;集信息填表、预约报名、签到打卡、活动通知、报名投票、班级统…...

自定义数据集,使用scikit-learn 中K均值包 进行聚类

1. 引言 K均值聚类是一种无监督学习方法&#xff0c;用于将数据集分为多个簇。通过计算数据点之间的距离并将它们分配到最近的簇中心&#xff0c;K均值算法可以帮助我们发现数据中的自然结构。 2. 数据集创建 首先&#xff0c;我们使用numpy创建一个自定义的二维数据集&…...

Lua中文语言编程源码-第十一节,其它小改动汉化过程

__tostring 汉化过程 liolib.c metameth[] {"__转换为字符串", f_tostring}, lauxlib.c luaL_callmeta(L, idx, "__转换为字符串") lua.c luaL_callmeta(L, 1, "__转换为字符串") __len 汉化过程 ltm.c luaT_eventname[] ltablib.c c…...

Android studio 创建aar包给Unity使用

1、aar 是什么&#xff1f; 和 Jar有什么区别 aar 和 jar包 都是压缩包&#xff0c;可以使用压缩软件打开 jar包 用于封装 Java 类及其相关资源 aar 文件是专门为 Android 平台设计的 &#xff0c;可以包含Android的专有内容&#xff0c;比如AndroidManifest.xml 文件 &#…...

4. 【.NET 8 实战--孢子记账--从单体到微服务--转向微服务】--什么是微服务--微服务设计原则与最佳实践

相比传统的单体应用&#xff0c;微服务架构通过将大型系统拆分成多个独立的小服务&#xff0c;不仅提升了系统的灵活性和扩展性&#xff0c;也带来了许多设计和运维上的挑战。如何在设计和实现微服务的过程中遵循一系列原则和最佳实践&#xff0c;从而构建一个稳定、高效、易维…...

大语言模型遇上自动驾驶:AsyncDriver如何巧妙解决推理瓶颈?

导读 这篇论文提出了AsyncDriver框架&#xff0c;致力于解决大语言模型在自动驾驶领域应用中的关键挑战。论文的主要创新点在于提出了大语言模型和实时规划器的异步推理机制&#xff0c;实现了在保持性能的同时显著降低计算开销。通过设计场景关联指令特征提取模块和自适应注入…...

第17章 读写锁分离设计模式(Java高并发编程详解:多线程与系统设计)

1.场景描述 对资源的访问一般包括两种类型的动作——读和写(更新、删除、增加等资源会发生变化的动作)&#xff0c;如果多个线程在某个时刻都在进行资源的读操作&#xff0c;虽然有资源的竞争&#xff0c;但是这种竞争不足以引起数据不一致的情况发生&#xff0c;那么这个时候…...

硬盘修复后,文件隐身之谜

在数字时代&#xff0c;硬盘作为数据存储的重要载体&#xff0c;承载着无数珍贵的信息与回忆。然而&#xff0c;当硬盘遭遇故障并经过修复后&#xff0c;有时我们会遇到这样一个棘手问题&#xff1a;硬盘修复后&#xff0c;文件却神秘地“隐身”&#xff0c;无法正常显示。这一…...

Ollama+ page Assist或Ollama+AnythingLLM 搭建本地知识库

参考&#xff1a;【AI】10分钟学会如何用RAG投喂数据给你的deepseek本地模型&#xff1f;_哔哩哔哩_bilibili 方法一&#xff1a;Ollama page Assist 本地知识库 ***下方操作比较精简&#xff0c;详情参考&#xff1a;Ollama 部署本地大语言模型-CSDN博客 1.下载Ollama 2.O…...

树莓派5添加摄像头 在C++下调用opencv

由于树莓派5 os系统升级,正常libcamera创建对象每次失败。 改如下方法成功。 1 创建管道 rpicam-vid -t 0 --codec mjpeg -o udp://127.0.0.1:8554 > /dev/null 2>&1 2 opencv从管道里读取 #include <opencv2/opencv.hpp> #include <iostream>int mai…...

redis之RDB持久化过程

redis的rdb持久化过程 流程图就想表达两点&#xff1a; 1.主进程会fork一个子进程&#xff0c;子进程共享主进程内存数据(fork其实是复制页表)&#xff0c;子进程读取数据并写到新的rdb文件&#xff0c;最后替换旧的rdb文件。 2.在持久化过程中主进程接收到用户写操作&#x…...

Linux后台运行进程

linux 后台运行进程&#xff1a;& , nohup-腾讯云开发者社区-腾讯云 进程 &&#xff0c;后台运行&#xff0c;结束终端退出时结束进程。 nohup 进程 &&#xff0c;后台运行&#xff0c;结束终端后依然保持运行。...

webpack配置方式

1. 基本配置文件 (webpack.config.js)&#xff08;导出一个对象&#xff09; 最常见的方式是通过 webpack.config.js 文件来配置 Webpack&#xff0c;导出一个对象。你可以在这个文件中导出一个配置对象&#xff0c;指定入口、输出、加载器、插件等。 // webpack.config.js m…...

123,【7】 buuctf web [极客大挑战 2019]Secret File

进入靶场 太熟悉了&#xff0c;有种回家的感觉 查看源代码&#xff0c;发现一个紫色文件 点下看看 点secret 信息被隐藏了 要么源代码&#xff0c;要么抓包 源代码没有&#xff0c;抓包 自己点击时只能看到1和3处的文件&#xff0c;点击1后直接跳转3&#xff0c;根本不出…...

OSPF基础(2):数据包详解

OSPF数据包(可抓包) OSPF报文直接封装在IP报文中&#xff0c;协议号89 头部数据包内容&#xff1a; 版本(Version):对于OSPFv2&#xff0c;该字段值恒为2(使用在IPV4中)&#xff1b;对于OSPFv3&#xff0c;该字段值恒为3(使用在IPV6中)。类型(Message Type):该OSPF报文的类型。…...

Vue 入门到实战 八

第8章 组合API与响应性 目录 8.1 响应性 8.1.1 什么是响应性 8.1.2 响应性原理 8.2 为什么使用组合API 8.3 setup组件选项 8.3.1 setup函数的参数 8.3.2 setup函数的返回值 8.3.3 使用ref创建响应式引用 8.3.4 setup内部调用生命周期钩子函数 8.4 提供/注入 8.4.1 …...

【学习总结|DAY036】Vue工程化+ElementPlus

引言 在前端开发领域&#xff0c;Vue 作为一款流行的 JavaScript 框架&#xff0c;结合 ElementPlus 组件库&#xff0c;为开发者提供了强大的构建用户界面的能力。本文将结合学习内容&#xff0c;详细介绍 Vue 工程化开发流程以及 ElementPlus 的使用&#xff0c;助力开发者快…...

HTML之CSS三大选择器

HTML之CSS三大选择器 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title><st…...

理解链接:加载二进制动态库

理解链接&#xff1a;加载二进制动态库 文章目录 理解链接&#xff1a;加载二进制动态库前情提要基本方式1 - 显式连接 dlopen基本方式 2 - 隐式链接 compile link ld衍生方式 3 - 弱链接 weak linking衍生方式 4 - dlmopen 加载到独立命名空间调试所有符号 补充知识1. 动态库…...

ASP.NET Core中Filter与Middleware的区别

中间件是ASP.NET Core这个基础提供的功能&#xff0c;而Filter是ASP.NET Core MVC中提供的功能。ASP.NET Core MVC是由MVC中间件提供的框架&#xff0c;而Filter属于MVC中间件提供的功能。 区别 中间件可以处理所有的请求&#xff0c;而Filter只能处理对控制器的请求&#x…...

《语义捕捉全解析:从“我爱自然语言处理”到嵌入向量的全过程》

首先讲在前面&#xff0c;介绍一些背景 RAG&#xff08;Retrieval-Augmented Generation&#xff0c;检索增强生成&#xff09; 是一种结合了信息检索与语言生成模型的技术&#xff0c;通过从外部知识库中检索相关信息&#xff0c;并将其作为提示输入给大型语言模型&#xff…...

大规模多准则决策模型构建详细方案

第二阶段&#xff1a;大规模多准则决策模型构建详细方案 目标 基于消费者群体偏好和个体交互数据&#xff0c;构建动态、可扩展的多准则决策模型&#xff0c;实现实时个性化产品排序。 一、技术架构设计 1. 系统架构图 [用户交互层] → (React前端) ↓ [API服务层] → (…...

Rust 语言:变革关键任务软件的新力量

软件无处不在&#xff0c;从手表、烤箱、汽车&#xff0c;甚至可能是牙刷中都有它的身影。更重要的是&#xff0c;软件控制着关乎生死的系统&#xff0c;如飞机、医疗设备、电网系统和银行基础设施等。如果软件工程师稍有疏忽&#xff0c;软件缺陷和漏洞可能导致数十亿美元的损…...

Linux特权组全解析:识别GID带来的权限提升风险

组ID&#xff08;Group ID&#xff0c;简称 GID&#xff09;是Linux系统中用来标识不同用户组的唯一数字标识符。每个用户组都有一个对应的 GID&#xff0c;通过 GID&#xff0c;系统能够区分并管理不同的用户组。 在Linux系统中&#xff0c;系统用户和组的配置文件通常包括以…...

安卓/ios脚本开发按键精灵经验小分享

1. 程序的切换 我们经常碰到这样的需求&#xff1a;打开最近的应用列表&#xff0c;选取我们想要的程序。但是每个手机为了自己的风格&#xff0c;样式都有区别&#xff0c;甚至连列表的滑动方向都不一样&#xff0c;我们很难通过模拟操作来识别点击&#xff0c;那么我们做的只…...

机器学习在癌症分子亚型分类中的应用

学习笔记&#xff1a;机器学习在癌症分子亚型分类中的应用——Cancer Cell 研究解析 1. 文章基本信息 标题&#xff1a;Classification of non-TCGA cancer samples to TCGA molecular subtypes using machine learning发表期刊&#xff1a;Cancer Cell发表时间&#xff1a;20…...

DeepSeek本地部署保姆级教程

由于DeepSeek近期遭受攻击&#xff0c;又加上用户访问量较大&#xff0c;导致总是服务不可用&#xff0c;让人十分窝火。有没有好的解决办法呢&#xff1f;答案是自己在电脑端部署一套&#xff0c;这样就不用和别人抢着用了。另外本地部署的好处还有保护隐私与减少延迟。 如果…...

无惧户外复杂环境,安科瑞 AKH-0.66/K-HW 开口式互感器准确测流

​安科瑞 吕梦怡 18706162527 1.产品特点 AKH-0.66/K-HW 系列互感器具有防水功能&#xff0c;可在户外使用&#xff0c;切面端口采用橡胶垫环绕可有效阻止雨水进入。互感器采用注塑技术&#xff0c;将互感器线圈直接在模具中进行注塑&#xff0c;同时二次侧引线采用防水端子…...

玩转Docker | 使用Docker部署httpd服务

玩转Docker | 使用Docker部署httpd服务 前言一、准备工作环境确认检查操作系统准备网站目录和配置文件二、拉取httpd镜像三、运行httpd容器运行容器命令检查容器状态四、验证httpd服务浏览器访问测试错误排查五、容器管理与维护查看容器状态停止和启动容器更新网站内容和配置六…...

MacOS 安装NVM

MacOS 安装NVM 方法一&#xff1a;使用Homebrew安装nvm 打开终端&#xff08;Terminal&#xff09;&#xff0c;输入以下命令安装Homebrew&#xff1a; /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"安装nvm…...

Qt 数据库SQLite 使用【01】基本功能

1.开发背景 Qt 开发过程中难免需要存储数据&#xff0c;可以选择保存到本地文件&#xff0c;但是查找比较麻烦&#xff0c;所以就有了数据库&#xff0c;主要是方便查找数据&#xff0c;增删改查等操作&#xff0c;而 SqLite 属于数据库中轻量级的存在&#xff0c;适合本地数据…...

http状态码:请说说 503 Service Unavailable(服务不可用)的原因以及排查问题的思路

503 Service Unavailable&#xff08;服务不可用&#xff09; 是一种HTTP状态码&#xff0c;表示服务器当前无法处理请求&#xff0c;通常是由于临时性原因导致服务中断。以下是它的常见原因和排查思路&#xff1a; 一、503错误的常见原因 1. 服务器过载 场景&#xff1a;服务…...

58页PPT学习华为面向业务价值的数据治理实践

目录 1. 正文解读... 1 2. 华为数据质量管控的质量度量框架是怎样的?... 2 3. 如何在企业中实施类似华为的数据质量管控...