• ADADADADAD

    分析mysqld的skip-grant-tables选项[ mysql数据库 ]

    mysql数据库 时间:2024-11-26 22:15:15

    作者:文/会员上传

    简介:

    这个选项会导致不使用权限系统来启动服务器,它将让任何用户可以访问服务器并且不受限制的访问所有数据库。在不使用授权表启动服务器后可以通过shell来执行mysqladmin flush-

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    这个选项会导致不使用权限系统来启动服务器,它将让任何用户可以访问服务器并且不受限制的访问所有数据库。在不使用授权表启动服务器后可以通过shell来执行mysqladmin flush-privileges或mysqladmin reload命令或者在连接到服务器后执行flush privileges语句来让正在运行的服务器再次使用授权表。

    使用--skip-grant-tables选项启动服务器

    [root@localhostmysql]#servicemysqldstopShuttingdownMySQL.SUCCESS![root@localhostmysql]#servicemysqldstart--skip-grant-tablesStartingMySQL..SUCCESS!

    现在就可以不使用用户和密码就可以登录服务器

    [mysql@localhost~]$mysqlWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis2Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>

    现在可以执行mysqladin flush-privileges命令让正在运行的服务器再次使用授权表

    [mysql@localhost~]$mysqladminflush-privileges

    现在不使用用户和密码就不能登录服务器了,必须使用用户和密码才能登录了

    [mysql@localhost~]$mysqlERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:NO)[mysql@localhost~]$mysql-uroot-pabcdmysqlmysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.ReadingtableinformationforcompletionoftableandcolumnnamesYoucanturnoffthisfeaturetogetaquickerstartupwith-AWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis5Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

    再次使用--skip-grant-tables选项启动服务器

    [root@localhostmysql]#servicemysqldstopShuttingdownMySQL..SUCCESS![root@localhostmysql]#servicemysqldstart--skip-grant-tablesStartingMySQL..SUCCESS!

    现在就可以不使用用户和密码就可以登录服务器

    [mysql@localhost~]$mysqlWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis2Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>

    现在可以执行mysqladin reload命令让正在运行的服务器再次使用授权表

    mysql@localhost~]$mysqladminreload

    现在不使用用户和密码就不能登录服务器了,必须使用用户和密码才能登录了

    [mysql@localhost~]$mysqlERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:NO)[mysql@localhost~]$mysql-uroot-pabcdmysqlmysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.ReadingtableinformationforcompletionoftableandcolumnnamesYoucanturnoffthisfeaturetogetaquickerstartupwith-AWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis5Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

    再次使用--skip-grant-tables选项启动服务器

    [root@localhostmysql]#servicemysqldstopShuttingdownMySQL.SUCCESS![root@localhostmysql]#servicemysqldstart--skip-grant-tablesStartingMySQL..SUCCESS!

    现在就可以不使用用户和密码就可以登录服务器

    [mysql@localhost~]$mysqlWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis2Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>

    现在可以执行flush privileges语句让正在运行的服务器再次使用授权表

    mysql>flushprivileges;QueryOK,0rowsaffected(0.12sec)

    现在不使用用户和密码就不能登录服务器了,必须使用用户和密码才能登录了

    [mysql@localhost~]$mysqlERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:NO)[mysql@localhost~]$mysql-uroot-pabcdmysqlmysql:[Warning]Usingapasswordonthecommandlineinterfacecanbeinsecure.ReadingtableinformationforcompletionoftableandcolumnnamesYoucanturnoffthisfeaturetogetaquickerstartupwith-AWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis5Serverversion:5.7.26-logSourcedistributionCopyright(c)2000,2019,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

    --skip-grant-tables选项也可以在选项文件my.cnf中进行设置。这个选项还会导致服务器在启动过程中禁止加载用户定义函数(udf),调度事件和安装插件语句中安装的插件。为了以任何方式来加载插件,使用--plugin-load选项。--skip-grant-tables选项也会导致disabled_storage_engines系统变量失效。

    flush privileges语句可以在服务器启动后通过执行其它操作来隐式执行。例如在升级过程中mysql_upgrade程序就会刷新权限。

    分析mysqld的skip-grant-tables选项.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysqld