+ -
当前位置:首页 → 问答吧 → 新手求助-MySQL 升级的问题

新手求助-MySQL 升级的问题

时间:2009-09-03

来源:互联网

Ubuntu804上自带的MySQL,执行了mysql_install_db,我自己的表也已经创建完毕

本地访问可以:

root@ubuntu804:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

设置了远程访问权限:
mysql> grant all PRIVILEGES on nw.* to root@'%' identified by 'root';
Query OK, 0 rows affected (0.04 sec)

查看数据库:
mysql> use nw
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------+
| Tables_in_nw |
+-----------------+
| t_activity_host |
| t_origin_log |
+-----------------+
2 rows in set (0.00 sec)

mysql> select * from t_origin_log;
Empty set (0.00 sec)
可以看到表已经创建成功了,但还没有记录。

root@ubuntu804:~# netstat -an |grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
本地端口也在监听

root@ubuntu804:~# ufw status
Firewall not loaded
本地防火墙未打开

本地telnet连接3306也可以连接

但是
root@ubuntu804:~# /usr/bin/mysqladmin -u root password 'root'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

并且远程访问一律失败,远程telnet3306也无法连接
C:\>telnet 192.168.14.199 3306
正在连接到192.168.14.199...不能打开到主机的连接, 在端口 3306: 连接失败

root@ubuntu804:~# /usr/bin/mysqladmin -u root password 'root'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

请问谁知道这是咋回事啊

作者: 0xff   发布时间: 2009-09-03

格式是

mysql -u root -p

作者: 木泥黑   发布时间: 2009-09-03

执行了,什么效果都没有,执行后debian.cnf内容不变,
远程还是连不上.

作者: 0xff   发布时间: 2009-09-03

SELECT Host, User FROM mysql.user

查看root用户是否具有远程访问权限,mysql默认是不具有的

作者: davidchenbin   发布时间: 2009-09-17

我也是上午才搞通的
首先
mysql>use mysql;
mysql>update user set Host = '%' where User = 'username';
然后
打开 /etc/mysql/my.cnf 文件,找到 bind-address = 127.0.0.1 修改为 bind-address = 0.0.0.0
重启mysql : sudo /etc/init.d/mysql restart
就好了,我在windows XP下用Navicat for mysql 一下就连上了。

作者: liyankx   发布时间: 2009-09-18

按楼上的OK,谢谢!

作者: xuehuihe.java   发布时间: 2010-07-21