lijfustc

导航

 

1、忘记密码后,怎么进入mysql

  • [root@node-mysql80 bin]# mysql
    • 这样进不去mysql

  

  • [mysqld]  
  • skip-grant-tables
    • 在my.cnf中加入上面的语句

  

 

  • [root@node-mysql80 bin]# /etc/init.d/mysql.server restart

  

 

  • [root@node-mysql80 bin]# mysql
    • 可以进入mysql

  

 

  • 接下来,可以在用下面的命令改密码
    • use mysql 
    • update set authentication_string = password("12345678") where user="root" and host="192.168.%"
  • 然后,把 skip-grang-tables 去掉
  • 最后,重启mysql

 

2、角色与权限

 

  • create role senior_dba, app_dev;

  

 

  • grant all on *.* to senior_dba with grant option;

  

 

  • grant select, update, insert, delete on test.* to app_dev;

  

 

  • create user 'tom'@'192.168.%' identified by '123';

  

 

  • grant senior_dba to 'tom'@'192.168.%';
    • 如果出错:ERROR 1227 (42000): Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation
    • 那么可以用命令:grant system_user on *.* to 'root'@'192.168.%';

  

  • show grants for 'tom'@'192.168.%';
    • 可以用 show grants for 'tom'@'192.168.%' using senior_dba;

  

  • create user 'jerry'@'192.168.%' identified by '123';

  

  • grant app_dev to 'jerry'@'192.168.%';

  

 

  • show grants for 'jerry'@'192.168.%' using app_dev;

  

 

3、数据库与数据实例

  

 

4、逻辑存储架构

  

 

 

5、操作数据库

  • (root@192.168.142.130)[(none)]> create database kaola;
    •   也可以用:create schema kaola;

  

 

  • (root@192.168.142.130)[(none)]> drop schema kaola;
    • 等同于:drop database kaola;

  

 

6、物理存储架构

  

  

 

7、mysqlfrm

  需要下载,然后安装

  • [root@node1 mysql-utilities-1.6.5]# python setup.py install

  

  • [root@node1 gx_day16]# mysqlfrm --server root:123@192.168.142.128  --diagnostic app01_userinfo.frm
    • 只有通过 --server参数,字符集才是正确的

  

 

posted on 2022-05-19 17:42  lijfustc  阅读(40)  评论(0)    收藏  举报