当前位置: 首页 > news >正文

改进网站建设/开网店怎么推广运营

改进网站建设,开网店怎么推广运营,c语言哪个网站可以做测试题,建筑招聘今天在用jdbc 连接MySQL数据库时一直不停的在 Statement stmt con.createStatement() ; 这一句上报空指针异常无法连接到数据库。 然后第一步用了http://outofmemory.cn/code-snippet/1085/java-usage-JDBC-connection-MYSQL-database这个网址上的一个…


今天在用jdbc 连接MySQL数据库时一直不停的在 Statement stmt = con.createStatement() ; 这一句上报空指针异常无法连接到数据库。


然后第一步用了http://outofmemory.cn/code-snippet/1085/java-usage-JDBC-connection-MYSQL-database这个网址上的一个方法,下载:mysql-connector-java-5.1.17-bin.jar JAR包,然后放进jdk1.6.0_37\jre\lib\ext 重启eclispe 就可以在JRE系统库中看到。不过没有将问题解决。


第二步参考了stackoverflow上的一个解决方案,将问题解决掉了,就是重新在MySQL数据库新建一个用户,然后将在该用户名下重建了数据库。最后在代码中将连接的用户名及密码,用新建用户。而不去使用root用户。具体内容参见:

“Connect failed: Access denied for user 'root'@'localhost' (using password: YES)” from php function

up vote12down votefavorite
7

I wrote some function used by a php webpage, in order to interact with a mysql database. When I test them on my server I get this error:

"Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" 

I am able to use them on my pc (using XAMPP) and I can navigate through the tables of the database using the command line in the server. Instead, the webpage fails to connect. I've checked the password but with no results, it's correct (otherwise I could not log in to mysql from the command line).

The call of the function is the following:

$conn = new mysqli("localhost", "root", "password", "shop");

Have I to set something in my server? Thanks

Edit: PHP version 5.3.3-7+squeeze1 mysql version: 5.1.49-3 both on debian

share|improve this question

migrated from superuser.com Jun 22 '11 at 20:11

This question came from our site for computer enthusiasts and power users.

 
1 
What version of PHP are you running? What version of MySQL? It sounds similar to bitshop.com/Blogs/tabid/95/EntryId/67/… –  Jack Murdoch Jun 22 '11 at 20:16

8 Answers 8

activeoldestvotes
up vote25down voteaccepted

I solved in this way: I logged in with root username

mysql -u root -p -h localhost

I created a new user with

CREATE USER 'francesco'@'localhost' IDENTIFIED BY 'some_pass';

then I created the database

CREATE DATABASE shop;

I granted privileges for new user for this database

GRANT ALL PRIVILEGES ON shop.* TO 'francesco'@'localhost';

Then I logged out root and logged in new user

quit;
mysql -u francesco -p -h localhost

I rebuilt my database using a script

source shop.sql;

And that's it.. Now from php works without problems with the call

 $conn = new mysqli("localhost", "francesco", "some_pass", "shop");

Thanks to all for your time :)

share|improve this answer
http://www.lbrq.cn/news/1269505.html

相关文章:

  • 二手书交易网站开发现状/苏州网站关键字优化
  • 做网站网站/北京seo报价
  • 做网站素材网/仁茂网络seo
  • 做网站 郑州公司哪家好/百度推广助手电脑版
  • 网站建设专题/学做网站需要学什么
  • 怎样做分销网站/网上营销方式和方法
  • 浙江华企做网站/外链网站是什么
  • 网站要怎么做才能获得市场份额/网站制作费用多少
  • 企业建站用什么软件/免费b站推广软件
  • 长治网站制作平台/百度电话销售
  • 成都企业网站制作/2022最新版百度
  • 鹤壁哪有做网站的/seo外包公司报价
  • 做网站的有哪些学校/seo一个月赚多少钱
  • 深圳网站建设公司招聘/关键词排名提升工具
  • 网站开发需求说明书模板/营销官网
  • 莱芜举报网站/搜索引擎seo外包
  • 如何在网站做qq群链接/自动app优化最新版
  • 网站专题建设合同/杭州seo俱乐部
  • 龙岩网站建设方式/网络促销
  • 学雷锋 做美德少年网站/南宁seo推广服务
  • 一个网站价格/不屏蔽的国外搜索引擎
  • 深圳做二类学分的网站/企业管理咨询培训
  • 建设部网站业绩如何录入/广告联盟全自动赚钱系统
  • 如何做网站美工/如何自己开发一个网站
  • 企业门户定制网站建设公司/上海优化公司
  • 税务网站如何做授权/全球搜怎么样
  • 做网站行业的动态/网站seo优化培训
  • 苏州市住房和城乡建设局官网/关键词首页排名优化公司推荐
  • 吃什么补肾最快最好/seo优化软件有哪些
  • 网站建设文化服务/seo文章范文
  • 系统性学习数据结构-第一讲-算法复杂度
  • linux 启动流程?
  • 【RK3568 RTC 驱动开发详解】
  • 【Android】使用 Intent 传递对象的两种序列化方式
  • java实现运行SQL脚本完成数据迁移
  • 暑期算法训练.12