访问mysql

gnod 2003-02-28 10:55:30
在本机上连接出错信息是:
error 1045:Access denied for user:'root@localhost'<Using password:YES>
在其它机器上访问,错误信息如下:
Cannot connect to MySQL server on 192.168.0.1:3306.Is there a MySQL server running on the machine/port you are trying to connect to?
密码正确,不知什么原因不能访问,请高手指点,谢谢!
...全文
39 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
gnod 2003-03-01
  • 打赏
  • 举报
回复
还有我现在新建了一个用户,用mysql -h localhost -u user01 -p 可以进去,但用
mysql -h 192.168.0.1 -u user01 -p 出现error 1045:Access denied for user:'user01@hostname'<Using password:YES>我该如何更改我的设置,谢谢!

输入mysql -h 192.168.0.1 -P 3306 -u root -p 后出现如下信息,
mysql Ver 11.16 Distrib 3.23.49, for Win95/Win98 (i32)
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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.
-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.
-B, --batch Print results with a tab as separator, each row on
a new line. Doesn't use history file.
--character-sets-dir=...
Directory where character sets are located.
-C, --compress Use compression in server/client protocol.
-D, --database=.. Database to use.
--default-character-set=...
Set the default character set.
-e, --execute=... Execute command and quit. (Output like with --batch)
-E, --vertical Print the output of a query (rows) vertically.
-f, --force Continue even if we get an sql error.
-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.
-G, --enable-named-commands
Named commands are enabled. Opposite to -g.
-i, --ignore-space Ignore space after function names.
-h, --host=... Connect to host.
-H, --html Produce HTML output.
-L, --skip-line-numbers
Don't write line number for errors.
--no-tee Disable outfile. See interactive help (\h) also.
-n, --unbuffered Flush buffer after each query.
-N, --skip-column-names
Don't write column names in results.
-O, --set-variable var=option
Give a variable an value. --help lists variables.
-o, --one-database Only update the default database. This is useful
for skipping updates to other database in the update
log.
-p[password], --password[=...]
Password to use when connecting to server
If password is not given it's asked from the tty.
-W, --pipe Use named pipes to connect to server

-P, --port=... Port number to use for connection.
-q, --quick Don't cache result, print it row by row. This may
slow down the server if the output is suspended.
Doesn't use history file.
-r, --raw Write fields without conversion. Used with --batch
-s, --silent Be more silent.
-S --socket=... Socket file to use for connection.
-t, --table Output in table format.
-T, --debug-info Print some debug info at exit.
--tee=... Append everything into outfile. See interactive help
(\h) also. Does not work in batch mode.
-u, --user=# User for login if not current user.
-U, --safe-updates[=#], --i-am-a-dummy[=#]
Only allow UPDATE and DELETE that uses keys.
-v, --verbose Write more. (-v -v -v gives the table output format)
-V, --version Output version information and exit.
-w, --wait Wait and retry if connection is down.

Default options are read from the following files in the given order:
C:\WINNT\my.ini C:\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 read

Possible variables for option --set-variable (-O) are:
connect_timeout current value: 0
max_allowed_packet current value: 16777216
net_buffer_length current value: 16384
select_limit current value: 1000
max_join_size current value: 1000000
swotcoder 2003-03-01
  • 打赏
  • 举报
回复
是你安装的问题了,我好奇怪你怎么做的居然能ban掉ip/port访问。。。
shuixin13 2003-03-01
  • 打赏
  • 举报
回复
D:\mysql\bin>mysql -h 192.168.0.1 -P 3306 -u root -p
>Enter password:
>Welcome to the MySQL monitor. Commands end with ; or \g.
>Your MySQL connection id is 1 to server version: 4.0.4-beta-max-nt-log
>
>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
>mysql>

你说出来的是帮助信息?
什么帮助信息?
gnod 2003-03-01
  • 打赏
  • 举报
回复
好像不行,出来的是帮助信息
shuixin13 2003-03-01
  • 打赏
  • 举报
回复
假设你的 MySQL 安装在 192.168.0.1 上
TCP/IP 端口为 3306
用户名为 root
密码为 123

mysql -h 192.168.0.1 -P 3306 -u root -p
gnod 2003-03-01
  • 打赏
  • 举报
回复
to swotcoder,但是外面的机器是,不认你的机器名,我也试过用域名/端口号,也是上面同样的错误。
gnod 2003-03-01
  • 打赏
  • 举报
回复
刚装的时候是没有密码,但是我用mysqladmin改密码后就进不去了。另外,机器是刚重装系统,上面只有一个mysql,通过localhost:3306是可以访问的,我想MySQL服务器的TCP/IP的端口是3306,应该是没有问题的,但是为什么我从其它机器上访问就出错呢?还望高手指点一二!谢谢!
swotcoder 2003-03-01
  • 打赏
  • 举报
回复
你的MySQL访问要使用机器名/端口号码,不是用ip/port访问。
bombshell 2003-03-01
  • 打赏
  • 举报
回复
难道端口冲突?你机器上还装了个mysql
gnod 2003-03-01
  • 打赏
  • 举报
回复
谢谢!shuixin13 问题已经解决!
是要建立一个对方IP的用户!
gnod 2003-03-01
  • 打赏
  • 举报
回复
to shuixin13
你好!我现在本机上可以访问了,但是从其它机器上访问还是出现error 1045:Access denied for >user:'user01@hostname'<Using password:YES>
shuixin13 2003-03-01
  • 打赏
  • 举报
回复
>还有我现在新建了一个用户,用mysql -h localhost -u user01 -p 可以进去,但用
>mysql -h 192.168.0.1 -u user01 -p 出现error 1045:Access denied for >user:'user01@hostname'<Using password:YES>我该如何更改我的设置,谢谢!


这是因为你寻的用户是这样的

+--------------+--------------+---------------+
| Host | User | Password |
+--------------+--------------+---------------+
| localhost | user01 | ************* |
+--------------+--------------+---------------+

你只有建立一个
Host = 192.168.0.1 的用户,
你才能使用 IP
shuixin13 2003-02-28
  • 打赏
  • 举报
回复
error 1045:Access denied for user:'root@localhost'<Using password:YES>

权限问题,
如果你的 MySQL 是刚安装的,
那你的 root 是没有密码的,
用下面的语句试试
mysql -h localhost -u root



Cannot connect to MySQL server on 192.168.0.1:3306.Is there a MySQL server running on the machine/port you are trying to connect to?

192.168.0.1 是你的 MySQL 服务器的地址吧,你的 MySQL 服务器的TCP/IP的端口是 3306 吗?
如果都是,你要问我这是为什么,
呵呵,我不知了

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧