首页 行业资讯 宠物日常 宠物养护 宠物健康 宠物故事

关于mysql数据库连接问题

发布网友

我来回答

2个回答

热心网友

'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)

这里提示是你的密码没有设置成功,所以你用zabbix用户登录时会报错
mysql> grant all on zabbic.* to 'zabbix'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@localhost wwwroot]# mysql -u zabbix -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.50-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

这个就成功了。
后面的你可以把你的sql文件贴出来,报的都是sql文件的错。

热心网友

如果报错的话把错误贴出来,还有就是你倒没倒连接jar包,3个jar加在程序里了吗?
import java.sql.*;
Connection conn =null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost/mybbs", "root", "root");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这样可以么?追问没看懂啊,我现在是导入数据库sql脚本报错,估计就导致了我启动zabbix_server报错了。虽然zabbi数据库已经付权了

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com