473,748 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to connect to MySQL database!

8 New Member
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="lo calhost";

$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_us ername,$mysql_p assword);

@mysql_select_d b($mysql_databa se) or die("<div align=\"center\ ">Unable to connect to MySQL database!</div>");

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

$result=mysql_q uery($query);

$ftp_server=@my sql_result($res ult,0);

...and some other functions here...



mysql_close($li nk);

?>[/PHP]


It gives error:


Unable to connect to MySQL database!

Someone please guide me.

Thank you very much.
Sep 22 '07 #1
8 5302
malaysiauser
8 New Member
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 MVP
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 Recognized Expert Contributor
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_us ernam e,$mysql_passwo rd) or die("Error: ".mysql_error() );

mysql_select_db ($mysql_databas e) 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
malaysiauser
8 New Member
pls check my site www.digimage,in fo

the error is unable to connect to mysql
Sep 23 '07 #5
mwasif
802 Recognized Expert Contributor
Did you use mysql_error() when connecting to database as I suggested in my previous post?
Sep 23 '07 #6
malaysiauser
8 New Member
Unable to connect to MySQL database! Error: Access denied for user 'digimage'@'loc alhost' 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
malaysiauser
8 New Member
i try to add another user and got this error;


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


im using cpanel to manage my MySQL database.

any idea?
Sep 24 '07 #8
mwasif
802 Recognized Expert Contributor
Unable to connect to MySQL database! Error: Access denied for user 'digimage'@'loc alhost' 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
4819
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: " . mysql_error()); echo "Connected successfully"; mysql_close($link);
23
4264
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 PHP . My testing program is as follows : <?php $si = function_exists('mysqli_connect');
12
2895
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
4134
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 mysql is as follow: $db=mysql_pconnect("hostname",$username,$password); if(!$db){ echo"ERROR:connecting failed"; exit; } else echo"you have connected to database succsessfully"; I want to know what should i write instead of "hostname"...
1
3162
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 Telnet, Remote Desk Connection, SSH. Here are my details ISP: Time Warner Connection Type: Cable Router: Lynksys Port Farwarding: enabled port farwarding to HTTP, Telnet, HTTPS, Remote Desktop Connection, SSH, MySQL etc to my laptop. Connection Type...
1
2412
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 modify it for use in my own database. It almost works for me LOL. contact.php returns my dive buddies first and last name and gives me the option to either Edit or Delete them. Currently the delete option is not active. When I choose to edit...
1
1809
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. i create a database saathii. Herewidth i created the database in my local server perfectly working. But i create the database thrown an error as cann't connect to MySql Server on localhost @ 10061. How to solve the problem.
5
1877
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 installed on that. When i run this (http://localhost/mysql.pl) it just prints out the contents of the file and not an array if the databases... Enlighten me, oh gods of perl #!"C:\xampp\perl\bin\perl.exe"
10
3397
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 { public static void main (String args) {
0
8987
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6793
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.