不用输入帐号密码登录MySQL的方法

  • A+
所属分类:运维教程

在本地登录mysql,每次都要输入密码,特别麻烦,有没有什么办法可以实现本地免密码登录?我们可以尝试如下操作。

首先进入到当前用户家目录,如root,执行如下命令:

  1. cd
  2. touch .my.cnf

然后再.my.cnf文件中添加如下的内容:

  1. [client]
  2. host=hostname
  3. user='username'
  4. password='password'

最后修改一下权限即可:

  1. chmod 700 .my.cnf

博主还没测试,所以没有截图,成功的朋友们记得回个截图,谢谢!

  • 问答中心
  • 微信小程序扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:28   其中:访客  28   博主  0

    • avatar you could try this out

      My husband and i ended up being so satisfied that Albert could carry out his investigations while using the precious recommendations he obtained from your own web page. It is now and again perplexing to just be giving away strategies which some others have been selling. We really see we now have the blog owner to be grateful to for that. The type of illustrations you have made, the simple blog navigation, the relationships you aid to instill – it is mostly amazing, and it is assisting our son in addition to our family believe that this issue is excellent, which is pretty serious. Many thanks for all the pieces!

      • avatar Immobilienbewertung

        Thanks for helping out, fantastic information.

        • avatar grolyrto lemcs

          hi!,I love your writing so a lot! proportion we be in contact more about your post on AOL? I need a specialist in this area to solve my problem. May be that is you! Looking ahead to look you.

          • avatar cbd oil that works 2020

            Have you ever thought about publishing an e-book or guest authoring on other sites?
            I have a blog based on the same topics you discuss and would love to have you
            share some stories/information. I know my viewers would appreciate
            your work. If you are even remotely interested, feel free to shoot me an email.

            • avatar GAY PARTY BOYS

              I cling on to listening to the news broadcast speak about getting boundless online grant applications so I have been looking around for the best site to get one. Could you advise me please, where could i find some?

              • avatar cbd oil that works 2020

                After looking at a few of the blog articles on your web site, I seriously appreciate your technique of writing a blog.
                I bookmarked it to my bookmark website list and will be
                checking back in the near future. Take a look at my web site too and let me know how you feel.

                • avatar slips.de

                  Ahaa, its fastidious conversation on the topic of this piece of writing here at
                  this blog, I have read all that, so now me also commenting at this place.

                  • avatar http://tinyurl.com/cbd-oil-that-works-2020

                    Cbd oil that works 2020
                    Having read this I believed it was rather informative.
                    I appreciate you finding the time and effort to put this article together.
                    I once again find myself personally spending a significant
                    amount of time both reading and commenting. But so what, it was
                    still worth it! best cbd oil for pain http://tinyurl.com/cbd-oil-that-works-2020 cbd
                    oil that works 2020 http://tinyurl.com/cbd-oil-that-works-2020