• mysql 分配权限


    有时候你没有其他账号,或者你把账号很邪恶的设置成用户名密码都是 ‘’的时候,

    你输入mySql是采用默认用户登录的 即使-u也没用

    那么如何赋予 ‘’其他权限呢。

    在linux 终端执行:

    1.killall -TERM mysqld  

    2. 

    [root@TSMIS bin]# /etc/init.d/mysqld start  --skip-grant-tables   

      3.

    3.1 用登录mysql 

    然后就可以grant all on *.* to ''@'localhost' identified by '';

    搞定 

    Insert mode
    [root@localhost mysql]# killall -TERM mysqld
    [root@localhost mysql]# /etc/init.d/mysql start --skip-grant-tables;
    Starting MySQL.                                            [  OK  ]
    [root@localhost mysql]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.1.28-rc-community MySQL Community Server (GPL)
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql> srae 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> truncate user;
    Query OK, 0 rows affected (0.00 sec)
    mysql>  insert into user( Host, User , Password , Select_priv , Insert_priv , Update_priv , Delete_priv , Create_priv , Drop_priv , Reload_priv , Hutdown_priv , Process_priv , File_priv , Grant_priv , References_priv , Index_priv , Alter_priv , Show_db_priv , Super_priv , Create_tmp_table_priv , Lock_tables_priv , Execute_priv , Repl_slave_priv , Repl_client_priv , Create_view_priv , Show_view_priv , Create_routine_priv , Alter_routine_priv , Create_user_priv) valuse('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'valuse('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'' at line 1
    mysql>  insert into user( Host, User , Password , Select_priv , Insert_priv , Update_priv , Delete_priv , Create_priv , Drop_priv , Reload_priv , Shutdown_priv , Process_priv , File_priv , Grant_priv , References_priv , Index_priv , Alter_priv , Show_db_priv , Super_priv , Create_tmp_table_priv , Lock_tables_priv , Execute_priv , Repl_slave_priv , Repl_client_priv , Create_view_priv , Show_view_priv , Create_routine_priv , Alter_routine_priv , Create_user_priv) values('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
    Query OK, 1 row affected, 3 warnings (0.00 sec)
    mysql> exit;
    Bye
    [root@localhost mysql]# /etc/init.d/mysql restart
    Shutting down MySQL.                                       [  OK  ]
    Starting MySQL.                                            [  OK  ]
    [root@localhost mysql]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.1.28-rc-community MySQL Community Server (GPL)
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql> use test;
    Database changed
    mysql> create table hello(name char(29));
    Query OK, 0 rows affected (0.00 sec)
    mysql> show tables;
    +----------------+
    | Tables_in_test |
    +----------------+
    | hello          | 
    +----------------+

    1 row in set (0.00 sec)

    TSMIS软件会把mysql的数据迁移到  $TSMISi目录下,所以我们要修改etc init.d mysql 下的datafile的路径,然后重启就可以了

    Insert mode
  • 相关阅读:
    设计模式|单例模式
    浅谈质量保障手段之巡检技术
    接口间参数传递的一种解决方案
    设计模式|开闭原则
    经验|项目测试中常见问题以及应对策略
    30个在线Python自学网站,再也不用到处找资料了
    解读数仓常用模糊查询的优化方法
    如何使用ModelBox快速提升AI应用性能?
    【Unity 框架】QFramework v1.0 使用指南 架构篇:04. 引入 Event | Unity 游戏框架 | Unity 游戏开发 | Unity 独立游戏
    【Unity 框架】QFramework v1.0 使用指南 架构篇:01. QFramework 架构简介 | Unity 游戏框架 | Unity 游戏开发 | Unity 独立游戏
  • 原文地址:https://www.cnblogs.com/xianqingzh/p/2024727.html
Copyright © 2020-2023  润新知