zoukankan      html  css  js  c++  java
  • mysql u root p 解释

    使用此命令首先确保你的mysql运行环境已经搭建好

    这是客户端连接mysql服务器的指令,比较全的写法是下面两种

    第一个是全拼,第二个是第一个的缩写

    mysql --host=localhost --user=myname --password=password mydb

    mysql -h localhost -u myname -ppassword mydb

    一般在使用中,我们会省略-h参数,mysql会自动默认为本地连接

    还有一点就是各个参数之间是否有空格的问题,-u后面可以有也可以省略空格,对于-p后面的参数我要单独说一下

    这是我从mysql官方文档拷过来的内容

    for password options, the password value is optional:

      If you use a -p or --password option and specify the password value, there must be no space between -p or --password= and the password following it.

      If you use a -p or --password option but do not specify the password value, the client program prompts you to enter the password. The password is not displayed as you enter it. This is more secure than giving the password on the command line. Other users on your system may be able to see a password specified on the command line by executing a command such as ps auxw

    具体就是:对于password选项,此选项是可选的

    如果你明确指定了-p或者--password的值,那么-p或者--password和密码值之间是不能有空格的。

    如果你使用了-p或者--password选项但是没有给出password值,客户端程序提示您输入密码。

    For mysql, the first nonoption argument is taken as the name of the default database. If there is no such option, mysql does not select a default database.

    对于MySQL,第一个非选项参数被当作默认数据库的名称。如果没有这样的选项,MySQL就不会选择默认数据库。

    也就是说在命令行中,你的mysql密码和-p或者--password参数之间有空格,mysql会认为你输入的是登录mysql后自动选择的数据库,而不是你所期望的密码

    当然命令行连接数据库还有其它参数,这里主要介绍几个经常使用的,其它请参考https://dev.mysql.com/doc/refman/5.5/en/connecting.html

  • 相关阅读:
    php之基础深入---类与对象篇
    php之cURL惯用
    php之header的不同用法
    java的图形界面初学惯用
    java 的http请求方式:HttpURLConnection和HttpClient
    数据挖掘-推荐算法入门
    性能测试平台效率优化的一次经验(python版)
    AndroidTest工程的自定义gradle task
    Robotium源码解读-native控件/webview元素的获取和操作
    工作中一些环境问题解决记录
  • 原文地址:https://www.cnblogs.com/phproom/p/9549229.html
Copyright © 2011-2022 走看看