473,412 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Unable to connect to MySQL database!

Im new user of PHP and MySQL.

I tried to use a script package for my web. I'd created a database.
And my connection scripts are as follow;

[PHP]<?php

$mysql_host="localhost";

$mysql_username="hidden";

$mysql_password="hidden";

$mysql_database="hidden";

$site_name="My Share Host"; //name of your site

$site_url="http://hidden"; //full url of your site without trailing slash!

//------------------------------------------------------------

//-----------Do not modify anything under this line!----------

//------------------------------------------------------------



$dbhandle=mysql_connect($mysql_host,$mysql_usernam e,$mysql_password);

@mysql_select_db($mysql_database) or die("<div align=\"center\">Unable to connect to MySQL database!</div>");

$query="SELECT server FROM ftp_connection WHERE 1";

$result=mysql_query($query);

$ftp_server=@mysql_result($result,0);

...and some other functions here...



mysql_close($link);

?>[/PHP]


It gives error:


Unable to connect to MySQL database!

Someone please guide me.

Thank you very much.
Sep 22 '07 #1
8 5259
when i entering from another computer....

this is the error message:

锘?div align="center">Unable to connect to MySQL database!
Sep 22 '07 #2
r035198x
13,262 8TB
when i entering from another computer....

this is the error message:

锘?div align="center">Unable to connect to MySQL database!
Are you able to connect to MySQL from the console using those details?
Sep 22 '07 #3
mwasif
802 Expert 512MB
Do not use words like HELP PLEASE in title. Kindly use CODE tags when posting source code.

Use mysql_error() when connecting to DB to know the correct error. e.g.

[PHP]$dbhandle=mysql_connect($mysql_host,$mysql_usernam e,$mysql_password) or die("Error: ".mysql_error());

mysql_select_db($mysql_database) or die("<div align=\"center\">Unable to connect to MySQL database! Error: ".mysql_error()."</div>");[/PHP]
After using this code, what error do you get?
Sep 22 '07 #4
pls check my site www.digimage,info

the error is unable to connect to mysql
Sep 23 '07 #5
mwasif
802 Expert 512MB
Did you use mysql_error() when connecting to database as I suggested in my previous post?
Sep 23 '07 #6
Unable to connect to MySQL database! Error: Access denied for user 'digimage'@'localhost' to database 'filehost'

i'd created a database "filehost" with a username and password.
So in my php setting i use that username and password.
And for that user i select 'allow all'. But i still getting access denied.
Im using cpanel.

tq sir..
Sep 23 '07 #7
i try to add another user and got this error;


Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'digi'@'localhost' (using password: YES) in /home/digimage/public_html/settings.inc.php on line 23
Error: Access denied for user 'digi'@'localhost' (using password: YES)


im using cpanel to manage my MySQL database.

any idea?
Sep 24 '07 #8
mwasif
802 Expert 512MB
Unable to connect to MySQL database! Error: Access denied for user 'digimage'@'localhost' to database 'filehost'

i'd created a database "filehost" with a username and password.
So in my php setting i use that username and password.
And for that user i select 'allow all'. But i still getting access denied.
Im using cpanel.

tq sir..
In CPanel, username and database are started with your hosting account username. e.g. if you have created a user named 'digimage' then it should be something like hostingusername_digimage and the same with the database name.
Sep 24 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Mr Dygi | last post by:
Hi, PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a problem with this simple code: <?php $link = mysql_connect("127.0.0.1","","") or die("Could not connect: " ....
23
cyberking
by: cyberking | last post by:
Hi. I have just started learning PHP along with MySQL. I am trying to connect to the MySQL DB server but unable to. I have been tryin. Please help. Its urgent cos I shall soon have to work on...
12
Rahulnewdelhi
by: Rahulnewdelhi | last post by:
hello all Hello all I installed php, mysql and IIS in xp. Problem is this while i run following file PHP Code: ---------------- <?php
1
by: iceboy | last post by:
Hello to all,I have a problem to connect PHP & MySQL together. I have created a form that gets the username & password from admin and connect him to database.the part of PHP script that connect to...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
1
by: Markw | last post by:
Hi folks I think I've got a variable problem but not 100% sure. Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to...
1
by: swarajtnj | last post by:
HI Everybody, I am a newly person on MySql Database. I am using ASP.net 2.0 with Using the Database as MySql 5.0. My client server 63.247.82.34. The server previlages as create a database as 2....
5
Markus
by: Markus | last post by:
I'll leave out the annoying 'i'm a newbie' speech and get to the point: i'm a newbie at perl ;) First thing i ever wrote in perl and it doesnt work. I'm using xampp as my localhost - with perl...
10
rhitam30111985
by: rhitam30111985 | last post by:
hi all .. java/jdbc newbie here ... i cant seem to perform the most basic step for database connectivity using java . here is my code : import java.sql.*; public class connect { ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.