关于mysql数据库连接问题
在mysql下创建了个zabbix库。也给他负了权限:mysql-uroot-pzhao@123createdatabasezabbix;grantallonzabbix...
在mysql下创建了个zabbix库。也给他负了权限:
mysql -uroot -pzhao@123
create database zabbix;
grant all on zabbix.* to zabbix@localhost identified by '123456';
flush privileges;
可
是启动应用还是报错 15355:20140820:132920.362 [Z3001] Connection to database
'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost'
(using password: YES)
另,执行这个几条命令报错是啥原因
cat ./create/schema/mysql.sql |mysql -uroot -pzhao@123 zabbix
Warning: Using a password on the command line interface can be insecure.
ERROR
1064 (42000) at line 1: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'type=InnoDB' at line 6
cat ./create/data/data.sql |mysql -uroot -pzhao@123 zabbix
Warning: Using a password on the command line interface can be insecure.
ERROR 1146 (42S02) at line 24: Table 'zabbix.config' doesn't exist
这是完整都日志
Starting Zabbix Server. Zabbix 1.8.2 (revision 11211).
**** Enabled features ****
SNMP monitoring: YES
IPMI monitoring: NO
WEB monitoring: YES
Jabber notifications: NO
ODBC: NO
SSH2 support: NO
IPv6 support: NO
**************************
[Z3001] Connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES) 展开
mysql -uroot -pzhao@123
create database zabbix;
grant all on zabbix.* to zabbix@localhost identified by '123456';
flush privileges;
可
是启动应用还是报错 15355:20140820:132920.362 [Z3001] Connection to database
'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost'
(using password: YES)
另,执行这个几条命令报错是啥原因
cat ./create/schema/mysql.sql |mysql -uroot -pzhao@123 zabbix
Warning: Using a password on the command line interface can be insecure.
ERROR
1064 (42000) at line 1: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'type=InnoDB' at line 6
cat ./create/data/data.sql |mysql -uroot -pzhao@123 zabbix
Warning: Using a password on the command line interface can be insecure.
ERROR 1146 (42S02) at line 24: Table 'zabbix.config' doesn't exist
这是完整都日志
Starting Zabbix Server. Zabbix 1.8.2 (revision 11211).
**** Enabled features ****
SNMP monitoring: YES
IPMI monitoring: NO
WEB monitoring: YES
Jabber notifications: NO
ODBC: NO
SSH2 support: NO
IPv6 support: NO
**************************
[Z3001] Connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES) 展开
2个回答
2014-08-20
展开全部
'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文件的错。
这里提示是你的密码没有设置成功,所以你用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文件的错。
更多追问追答
追问
那我执行MySQL -uzabbix -p123456能够进入数据库啊?为哈
追答
这句本来就是对的啊,肯定能进入的啊
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
展开全部
如果报错的话把错误贴出来,还有就是你倒没倒连接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();
}
这样可以么?
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数据库已经付权了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询