MySQL开启 远程访问

IT运维 3 748
00031496
00031496 管理员 关注 2022年9月30日 16:59 编辑
<p>1.从服务器上<font face="宋体" style="font-size: 10.5pt;">登入</font><span style="font-family: Verdana; font-size: 10.5pt;">&nbsp;mysql</span><font face="宋体" style="font-size: 10.5pt;">:</font></p><p></p><p><span style="font-family: &quot;Courier New&quot;; font-size: 10.5pt;">mysql -u root -p</span></p><p></p><p><span style="font-family: &quot;Courier New&quot;; font-size: 10.5pt;">Enter password:&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="font-family: &quot;Courier New&quot;; font-size: 10.5pt;">//</span><font face="宋体" style="font-size: 10.5pt;">输入</font><font face="Courier New" style="font-family: &quot;Courier New&quot;; font-size: 10.5pt;">root</font><font face="宋体" style="font-size: 10.5pt;">的密码</font></p><p><font face="宋体" style="font-size: 10.5pt;"><br></font></p><p></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 10.5pt;">2.<font face="宋体">使用&nbsp;</font><font face="Calibri Light">mysql</font><font face="宋体">库 :</font></span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 10.5pt;">use mysql;</span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-size: 10.5pt; font-family: &quot;Calibri Light&quot;;">3.</span><font face="宋体" style="font-size: 10.5pt;">查看用户表 :</font></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">SELECT`Host`,`User`&nbsp;FROM&nbsp;user;</span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">4.</span><font face="宋体" style="font-size: 12pt;">更新用户表 :</font></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">UPDATE&nbsp;user&nbsp;SET&nbsp;`Host` =&nbsp;'%'WHERE&nbsp;`User` =&nbsp;'root'&nbsp;LIMIT 1;</span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">5.</span><font face="宋体" style="font-size: 12pt;">强制刷新权限 :</font></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">flush&nbsp;privileges;</span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">完成以上步骤即可使用root用户远程连接</font></span><a href="http://www.2cto.com/database/"><span style="font-family: &quot;Calibri Light&quot;; color: rgb(0, 102, 204); font-size: 12pt;"><font face="宋体">数据库</font></span></a><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">了。</font></span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">注</font></span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">:</font></span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">如果还是无法远程连接</font></span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">,</font></span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="宋体">则需要检查</font>mysql<font face="宋体">配置文件</font><font face="Calibri Light">my.cnf</font><font face="宋体">注释掉</font></span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">#bind</span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">-</span><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;">adress &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=127.0.0.1<font face="宋体">或</font><font face="Calibri Light">localhost</font></span></p><p style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><img src="https://51techud.yykj.com:9002/forumpic/it1.png" style="max-width:100%;"><span style="font-family: &quot;Calibri Light&quot;; font-size: 12pt;"><font face="Calibri Light"><br></font></span></p>
赞(0) 收藏(0)  分享
相关标签:
3个回复
  • 00224211
    2022年10月11日 15:36
    简明,易懂 !!!
    0 0
Vaptcha启动中...