恐怕是权限问题吧,用“mysql -uroot -pyoob -h127.0.0.1”登录试试。注意参数后面没有空格,-h是你机器的ip
看看mysql.user表里root是否有localhost权限
mysql> select user,host from user;
+------+-----------+
| user | host      |
+------+-----------+
| root | %         |
| root | light     |
| root | localhost |
+------+-----------+

解决方案 »

  1.   

    'Access denied for user 'root'@'localhost' 检查授权
      

  2.   

    谢谢zhu19774279 和版主大大的回复。
    我在按照网上移植方法的过程中,省略了一些步骤。
    1.[root@linux bin]# ./mysql_install_db --user=root --force --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var/mysql
    因为老是出现如下错误,又没找到解决办法:Installing MySQL system tables...
    131213 11:17:49 - mysqld got signal 11 ;
    This could be because you hit a bug. It is also possible that this binary
    or one of the libraries it was linked against is corrupt, improperly built,
    or misconfigured. This error can also be caused by malfunctioning hardware.
    We will try our best to scrape up some info that will hopefully help diagnose
    the problem, but since we have already crashed, something is definitely wrong
    and this may fail.key_buffer_size=8384512
    read_buffer_size=131072
    max_used_connections=0
    max_threads=151
    threads_connected=1
    It is possible that mysqld could use up to
    key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337743 K
    bytes of memory
    Hope that's ok; if not, decrease some variables in the equation.thd: 0x494698
    Attempting backtrace. You can use the following information to find out
    where mysqld died. If you see no messages after this, something went
    terribly wrong...
    stack_bottom = 0x413c8df8 thread_stack 0x30000
    [0x413c7ba4]
    [(nil)]
    Trying to get some variables.
    Some pointers may be invalid and cause the dump to abort...
    thd->query at 0x4a5c68 = REPLACE INTO tmp_user SELECT @current_hostname,'root','
    ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y
    ','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @cu
    rrent_hostname) != 'localhost'
    thd->thread_id=1
    thd->killed=NOT_KILLED
    The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
    information that should help you find out what is causing the crash.Installation of system tables failed!  Examine the logs in
    /usr/local/mysql/var/mysql for more information.You can try to start the mysqld daemon with:    shell> /usr/local/mysql/libexec/mysqld --skip-grant &and use the command line tool /usr/local/mysql/bin/mysql
    to connect to the mysql database and look at the grant tables:    shell> /usr/local/mysql/bin/mysql -u root mysql
        mysql> show tablesTry 'mysqld --help' if you have problems with paths.  Using --log
    gives you a log in /usr/local/mysql/var/mysql that may be helpful.Please consult the MySQL manual section
    'Problems running mysql_install_db', and the manual section that
    describes problems on your OS.  Another information source are the
    MySQL email archives available at http://lists.mysql.com/.Please check all of the above before mailing us!  And remember, if
    you do mail us, you MUST use the /usr/local/mysql/scripts/mysqlbug script!所以我在/usr/local/mysql/share/mysql目录下直接执行
    [root@linux mysql]# pwd
    /usr/local/mysql/share/mysql
    [root@linux mysql]# ./mysql.server start
    Starting MySQL SUCCESS!是不是我这个地方有问题啊?我刚接触这个,不是很懂。麻烦你们啦。
      

  3.   

    [root@linux mysql]# mysql -uroot -pyoob -h192.168.1.241
    ERROR 1130 (HY000): Host '192.168.1.241' is not allowed to connect to this MySQL
     server
    查了下,禁止远程登录。我的配置:my.cnf
    [mysqld]
    datadir=/usr/local/mysql/var/mysql
    socket=/tmp/mysql.sock
    user=root
    old_passwords=1[mysqld_safe]
    log-error=/usr/local/mysql/var/log/mysqld.log
    pid-file=/usr/local/mysql/var/run/mysqld.pid
      

  4.   


    shdj111 你好,请问该怎么修改呀
      

  5.   


    shdj111 你好,请问该怎么修改呀
    首先看一下哪里可以用root帐号登录use mysql;
    select user, host from user;找一台能登录root的机器,以root登录后执行:Grant all privileges on *.* to root@'%' identified by 'admin';
    flush privileges;然后本地就可以登录了。
      

  6.   

    mysql> select user,host from user;
    ERROR 1046 (3D000): No database selected
    mysql> use mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -ADatabase changed
    mysql> select user,host from user;
    Empty set (0.00 sec)
    好像表是空的?
      

  7.   

    可以看下这个http://blog.csdn.net/feihong247/article/details/7791105
      

  8.   

    mysql> select user,host from user;
    ERROR 1046 (3D000): No database selected
    mysql> use mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -ADatabase changed
    mysql> select user,host from user;
    Empty set (0.00 sec)
    好像表是空的?
    你是怎么安装的?卸载重装可以吗?
      

  9.   


    我是在linux上交叉编译后拷贝到ARM板子上的。
    我根据这篇:http://www.cnblogs.com/Charles-Zhang-Blog/p/3529980.html
    移植的,编译倒是没问题,就是后面的配置可能出问题了,其中有一步(上面提到的mysql_install_db)老是出错。我没解决,就直接启动Mysql。也是能成功启动的。
    只不过登录的时候登录不成功。不知道跟那一步是不是有关联。
      

  10.   

    我觉得原因可能是mysql_install_db(授权表)没有执行成功的。我安装时错误如下:
    我没看懂是什么意思。哪位朋友遇到过麻烦说下,谢谢。[root@linux bin]# ./mysql_install_db --user=root --force --basedir=/usr/local/my
    sql --datadir=/usr/local/mysql/var/mysql
    Installing MySQL system tables...
    131213 15:09:33 - mysqld got signal 11 ;
    This could be because you hit a bug. It is also possible that this binary
    or one of the libraries it was linked against is corrupt, improperly built,
    or misconfigured. This error can also be caused by malfunctioning hardware.
    We will try our best to scrape up some info that will hopefully help diagnose
    the problem, but since we have already crashed, something is definitely wrong
    and this may fail.key_buffer_size=16777216
    read_buffer_size=262144
    max_used_connections=0
    max_threads=151
    threads_connected=1
    It is possible that mysqld could use up to
    key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 133332 K
    bytes of memory
    Hope that's ok; if not, decrease some variables in the equation.thd: 0x4944a8
    Attempting backtrace. You can use the following information to find out
    where mysqld died. If you see no messages after this, something went
    terribly wrong...
    stack_bottom = 0x41ba5df8 thread_stack 0x30000
    [0x41ba4ba4]
    [(nil)]
    Trying to get some variables.
    Some pointers may be invalid and cause the dump to abort...
    thd->query at 0x4a5070 = REPLACE INTO tmp_user SELECT @current_hostname,'root','
    ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y
    ','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @cu
    rrent_hostname) != 'localhost'
    thd->thread_id=1
    thd->killed=NOT_KILLED
    The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
    information that should help you find out what is causing the crash.Installation of system tables failed!  Examine the logs in
    /usr/local/mysql/var/mysql for more information.You can try to start the mysqld daemon with:    shell> /usr/local/mysql/libexec/mysqld --skip-grant &and use the command line tool /usr/local/mysql/bin/mysql
    to connect to the mysql database and look at the grant tables:    shell> /usr/local/mysql/bin/mysql -u root mysql
        mysql> show tablesTry 'mysqld --help' if you have problems with paths.  Using --log
    gives you a log in /usr/local/mysql/var/mysql that may be helpful.Please consult the MySQL manual section
    'Problems running mysql_install_db', and the manual section that
    describes problems on your OS.  Another information source are the
    MySQL email archives available at http://lists.mysql.com/.Please check all of the above before mailing us!  And remember, if
    you do mail us, you MUST use the /usr/local/mysql/scripts/mysqlbug script!
      

  11.   


    我是楼主,被限制回复了。
    各位大侠再看看。
    pwd
    /usr/local/mysql/bin
    ./mysqld_safe --skip-grant-tables &use mysql;select user, host from user;
    Empty set (0.00 sec)。INSERT INTO user(host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'root', PASSWORD(‘12345'), 'Y', 'Y','Y'); select user,host from user;
    +------+-----------+
    | user | host      |
    +------+-----------+
    | root | localhost |
    +------+-----------+
    1 row in set (0.01 sec)
    quit
    killall mysqld
    cd ../share/mysql/
    ./mysql.server start
    Starting MySQL.. SUCCESS!
    mysql -uroot -p12345
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password
    ES)
      

  12.   

    不懂arm。
    不过你看看官方文档的4.4 MySQL Installation-Related Programs及其子章节对你是否有帮助,都是关于初MySQL初始化问题的,比如修复权限表、初始化数据表和原始数据。
    http://dev.mysql.com/doc/refman/5.1/en/programs-installation.html
    http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db.html