MySQL与PHP服务器端技术_PHP中的数据库连接和服务器上的Mysql

bd96500e110b49cbb3cd949968f18be7.png

Dear all

My name is Sarfaraz. I have created a small website for learning purpose only.

I have developed it in PHP and Mysql. The site is working fine on local server with My sql database. The sign up, Login pages are working just fine.

But when i am uploading the site on my hosting server all pages are working but pages having MYsql connectivity is displaying errors.

The actual Error is

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ''root''@''localhost'' (using password: NO) in /home/jahanina/public_html/sign_up.php on line 48

Access denied for user ''root''@''localhost'' (using password: NO)

Actually I need the correct method to use username/ passsword and database in PHp and Mysql on hosting server.

Thank you

Sarfaraz

解决方案Typically you will not be able to use "root" as the login user for your site neither web.

If the server is placed in another company typically they will want to control their computer and be able to do maintenance tasks there.

Speak with your hosting company, they will give you the username and password you need to use for the database or how to change it.

If you''ve uploaded the database structure and data into your remote server you should have the username and password for it. Use those connection details and try it again.

Good luck.

after you hosted you will get username and password from hosting company you should use that for your server page where you written your database connectivity code and you should must have some password

Goto Mysql database in your cpanel.

Create database

add anew user and password

add user to database

Give privileges to the user

Make changes

Now open your php page where the database connectivity is then replace username and password with the username and password you created in cpanel.

Type name of database as you created e.g yourhost_abc.

Now test your page it will work just fine.

Good luck

Sarfaraz

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值