我在控制台底下操作mysql。一登录就是root帐户,我不想用这么高的权限,想用一个稍微低级别权限的帐户,不知道怎么切换?哪位知道呢???告诉一声。

解决方案 »

  1.   

    先exit;
    然后 mysql -u用户名 -p密码
      

  2.   

    我试了一下楼上两位的命令,没法用
    我装的是mysql5.*,我试出来的命令是:mysql -u 用户名 -p 数据库名,回车后会要求输入密码,然后就可以登录了。不过还是谢谢楼上两位。
      

  3.   

    linux:~ # mysql flush host
    linux:~ # mysql -uname -ppassword
      

  4.   

    我用的是MYSQL5.0.装好MySql中,有一个已设好的用户root。
    当进入MySql的黑色窗体时,就会有一个Enter Password,要求输入密码。
    默认的情况下,自动是以root用户登录,只要输入正确的密码就可以登录。在登录root的情况下,我又创建了新的用户:
    create user 用户名 identified by '密码';
    返回也很正常.如果按上面楼主的方法:
    先exit,这样就退出整个控制台,再切换用户还得重新启动,那样还是在root下要求输入密码,一切又恢复了原来,希望大家能具体点,最好是有截图,我还是菜鸟,谢谢帮忙!
      

  5.   


    我刚弄好了不是打开MYSQL的CMD LINE ,而是打开WINDOWS 的命令提示符(CTR+R 输入CMD)后,转入program files\mysql server 5.1\bin目录,再键入 mysql -u +用户名 -p +数据库名,之后会提示输入密码
      

  6.   

    转入program files\mysql server 5.1\bin目录是这样 的:
    cd\program files\mysql server 5.1\bin
      

  7.   

    嗯,要先退出mysql的命令行界面,然后运行windows的命令行,进入安装路径下的bin文件夹,然后有两种方法:
    方法1:mysql -u用户名 -p密码(注意-u和用户名及-p和密码间均无空格,密码没有单引号)
    方法2:mysql -u 用户名 -p 数据库名 回车后输入用户密码即可
      

  8.   

    要先退出mysql的命令行界面,然后运行windows的命令行,进入安装路径下的bin文件夹,然后有两种方法:
    方法1:mysql -u用户名 -p密码(注意-u和用户名及-p和密码间均无空格,密码没有单引号)
    方法2:mysql -u 用户名 -p 数据库名 回车后输入用户密码即可
    测试好使!!!!!
      

  9.   

    测试不好使,,还给跳出这个。
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u lyloric -p lyloric lyloric
    mysql  Ver 14.12 Distrib 5.0.37, for Win32 (ia32)
    Copyright (C) 2002 MySQL AB
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL license
    Usage: mysql [OPTIONS] [database]
      -?, --help          Display this help and exit.
      -I, --help          Synonym for -?
      --auto-rehash       Enable automatic rehashing. One doesn't need to use
                          'rehash' to get table and field completion, but startup
                          and reconnecting may take a longer time. Disable with
                          --disable-auto-rehash.
      -A, --no-auto-rehash
                          No automatic rehashing. One has to use 'rehash' to get
                          table and field completion. This gives a quicker start of
                          mysql and disables rehashing on reconnect. WARNING:
                          options deprecated; use --disable-auto-rehash instead.
      -B, --batch         Don't use history file. Disable interactive behavior.
                          (Enables --silent)
      --character-sets-dir=name
                          Directory where character sets are.
      --default-character-set=name
                          Set the default character set.
      -C, --compress      Use compression in server/client protocol.
      -#, --debug[=#]     This is a non-debug version. Catch this and exit
      -D, --database=name Database to use.
      --delimiter=name    Delimiter to be used.
      -e, --execute=name  Execute command and quit. (Disables --force and history
                          file)
      -E, --vertical      Print the output of a query (rows) vertically.
      -f, --force         Continue even if we get an sql error.
      -G, --named-commands
                          Enable named commands. Named commands mean this program's
                          internal commands; see mysql> help . When enabled, the
                          named commands can be used from any line of the query,
                          otherwise only from the first line, before an enter.
                          Disable with --disable-named-commands. This option is
                          disabled by default.
      -g, --no-named-commands
                          Named commands are disabled. Use \* form only, or use
                          named commands only in the beginning of a line ending
                          with a semicolon (;) Since version 10.9 the client now
                          starts with this option ENABLED by default! Disable with
                          '-G'. Long format commands still work from the first
                          line. WARNING: option deprecated; use
                          --disable-named-commands instead.
      -i, --ignore-spaces Ignore space after function names.
      --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
      -b, --no-beep       Turn off beep on error.
      -h, --host=name     Connect to host.
      -H, --html          Produce HTML output.
      -X, --xml           Produce XML output
    。。Default options are read from the following files in the given order:
    C:\my.ini C:\my.cnf C:\Windows\my.ini C:\Windows\my.cnf C:\Program Files\MySQL\MySQL Server 5.0\
    ni C:\Program Files\MySQL\MySQL Server 5.0\my.cnf
    The following groups are read: mysql client
    The following options may be given as the first argument:
    --print-defaults        Print the program argument list and exit
    --no-defaults           Don't read default options from any options file
    --defaults-file=#       Only read default options from the given file #
    --defaults-extra-file=# Read this file after the global files are readVariables (--variable-name=value)
    and boolean options {FALSE|TRUE}  Value (after reading options)
    --------------------------------- -----------------------------
    auto-rehash                       TRUE
    character-sets-dir                (No default value)
    default-character-set             latin1
    compress                          FALSE
    database                          (No default value)
    delimiter                         ;
    vertical                          FALSE
    force                             FALSE
    named-commands                    FALSE
    local-infile                      FALSE
    no-beep                           FALSE
    host                              (No default value)
    html                              FALSE
    xml                               FALSE
    line-numbers                      TRUE
    unbuffered                        FALSE
    column-names                      TRUE
    sigint-ignore                     FALSE
    port                              3306
    prompt                            mysql>
    quick                             FALSE
    raw                               FALSE
    reconnect                         TRUE
    shared-memory-base-name           (No default value)
    socket                            (No default value)
    ssl                               FALSE
    ssl-ca                            (No default value)
    ssl-capath                        (No default value)
    ssl-cert                          (No default value)
    ssl-cipher                        (No default value)
    ssl-key                           (No default value)
    ssl-verify-server-cert            FALSE
    table                             FALSE
    debug-info                        FALSE
    user                              lyloric
    safe-updates                      FALSE
    i-am-a-dummy                      FALSE
    connect_timeout                   0
    max_allowed_packet                16777216
    net_buffer_length                 16384
    select_limit                      1000
    max_join_size                     1000000
    secure-auth                       FALSE
    show-warnings                     FALSE
      

  10.   

    创建一个 mysql.exe 快捷方式
    再后边跟上参数我的是
    "E:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" "--defaults-file=E:\Program Files\MySQL\MySQL Server 5.5\my.ini" "-ulee" "-p"-ulee 表示登陆用户是lee 打开会提示密码 输入密码 用户登陆成功