MySQL

MySQL

1、介绍

2、隔离级别

-- 
mysql>select @@tx_isolation ;
-- 当前会话
mysql>select @@session.tx_isolation ;
-- 查询全局
mysql>select @@global.tx_isolation ;

-- 设置隔离级别,必须在事务启动前设置
mysql>set transaction isolation level read uncommitted ;
mysql>set transaction isolation level read committed ;
mysql>set transaction isolation level repeatable read ;
mysql>set transaction isolation level serializable ;

-- 关闭自动提交,0|off
mysql>set autocommit=0 ;
-- 启动自定提交,1 | on
mysql>set autocommit=off ;

-- 开启事务
mysql>start transaction ;

3、Mysql完全卸载

  1. 控制面板卸载mysql

  2. 删除mysql安装目录

  3. 删除C:ProgramDataMySQL数据文件夹

  4. 删除注册表

    HKEY_LOCAL_MACHINESYSTEMControlSet001ServicesEventlogApplicationMySQL

    HKEY_LOCAL_MACHINESYSTEMControlSet002ServicesEventlogApplicationMySQL

4、mysql远程root连接拒绝

  1. 修改授权

    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
    
  2. 清理授权

    mysql>FLUSH PRIVILEGES;
    
  3. 显式授权

    mysql>SHOW GRANTS FOR 'Max'@'localhost';
    mysql>show grants ;
    -- 撤销授权
    mysql>revoke all on *.* from dba@localhost;
    

5、忘记root密码

  1. 停止mysql服务器

    • linux

      $>sudo kill -9 <pid>
      
    • windows

      控制面板中停止。

  2. 启动服务时,跳过授权表

    • linux

      $>mysqld_safe --skip-grant-tables &
      
    • windows

      cmd>mysqld.exe --skip-grant-tables
      
  3. 修改密码

    1. 无验证登录

      cmd>mysql.exe -uroot
      
    2. 修改系统用户表

      mysql>update mysql.user set password=password('root') where user='root' ;
      mysql>flush privileges ;
      mysql>exit ;
      
  4. 重启mysql

6、设置mysql执行时间精度

mysql>set profiling=1 ;
mysql>select count(1) from t ;
mysql>show profiles ;
原文地址:https://www.cnblogs.com/xupccc/p/9661967.html