473,382 Members | 1,369 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,382 software developers and data experts.

Connecting my Mysql Database with my web server

Vkas
78
i have a domain www.thesunriseschool.com

for connecting the database i am using

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $sId=session_id();
  3. $uIp=$_SERVER['REMOTE_ADDR'];
  4. $time=time();
  5. $date_now=date("d/m/Y", $time);
  6. $time_now=date("G:i:s", $time);
  7. if(isset($_SERVER['HTTP_REFERER'])){
  8.     $referer=$_SERVER['HTTP_REFERER'];
  9. }else{
  10.     $referer="http://www.thesunriseschool.com";
  11. }
  12.  
  13. if($_SERVER['HTTP_HOST']=="localhost" || $_SERVER['HTTP_HOST']=="192.168.1.12"){
  14.     $dbhost = 'localhost';
  15.     $dbuser = 'root';
  16.     $dbpass = '';
  17.     $dbname = 'Sunrise';
  18. }else{
  19.     $dbhost = 'http://www.thesunriseschool.com/';
  20.     $dbuser = 'xxxxx';
  21.     $dbpass = 'xxxxx';
  22.     $dbname = 'thesun_Sunrise';
  23. }
  24.  
  25. $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ('I cannot connect to the database because: ' . mysql_error());
  26. mysql_select_db ($dbname);
  27. function dbQuery($sql){
  28.     $qry=mysql_query($sql);
  29.     return $qry;}
  30. ?>



i have created , a user as welll as uploaded thedatabase using the cpanel of the domain successfully but it is giving me this error

Can Any one can help me.... i think i am not writing the exact parameters


Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'http' (1) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Unknown MySQL server host 'http' (1)
Nov 14 '09 #1

✓ answered by Dormilich

you don’t connect to a DB via the HTTP protocol. just omit "http://".

8 8462
Dormilich
8,658 Expert Mod 8TB
you don’t connect to a DB via the HTTP protocol. just omit "http://".
Nov 14 '09 #2
Vkas
78
ya that i done immediately......this was the 1st problemmm

thanks...
But

Now its giving this error Yet i have created following using Mysql database wizard in cpanel ........

Db= thesun_Sunrise
user=****
pass= ****



but it gives this ... error

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'thesun_Vkassun'@'server.pmnhost.net' (using password: NO) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Access denied for user 'thesun_Vkassun'@'server.pmnhost.net' (using password: NO)
Nov 14 '09 #3
Dormilich
8,658 Expert Mod 8TB
@Vkas


obviously you forgot to pass the password.
Nov 14 '09 #4
Vkas
78
which password i should give for this user!!!!!!!

i am using this configuration for my local site
$dbuser='root'
$dbpass='' (Empty)
$dbname='Sunrise'

and it works... connects to the database after this i export the database file
and save it on my hard disk...


Now for web server
i have created a data base name Sunrise Using mysqlwizard in cpanel of the site...

and user Vkasun with a password
i import my local database using phpmyadmin of cpanel it is restored successfully ... and change the configuration of my phpmysql connection but it doesnt works... y???
Nov 14 '09 #5
Vkas
78
which password should i passed


My local configuration is
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'sunrise';
phpmyadmin Having (root with password:NO)

this works perfectly at local then with the same condition i Export the database and save it top my hard drive after that

i goto the cpanel make a data base using mysqlwizard
Databasename : thesun_Sunrise
User :thesun_Vkassun
pass : xyx

and the restore the database by the phpmyadmin...in the cpanel
database is successfully store

the i change the setting of my connection to
$dbhost = 'www.thesunriseschool.com';
$dbuser = '****';
$dbpass = '****';
$dbname = 'thesun_Sunrise';.


but it gives me this error


Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'thesun_Vkassun'@'server.pmnhost.net' (using password: YES) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Access denied for user 'thesun_Vkassun'@'server.pmnhost.net' (using password: YES)


i dont know y
Nov 14 '09 #6
Dormilich
8,658 Expert Mod 8TB
did you enable remote acces for the DB (that is usually disabled)?
Nov 14 '09 #7
Vkas
78
from where should i do that from c panel ????
Nov 16 '09 #8
Dormilich
8,658 Expert Mod 8TB
I do not use c panel… so I don’t know
Nov 16 '09 #9

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

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
3
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, but I cannot connect...
6
by: MBS | last post by:
Yeah, read the previous posts...I did that. None answer my question. I just installed PHP 5.0.4, Apache 2.0.54, and MySQL 4.1.13 a few days ago on WinXP SP2. My goal is to learn to use these...
4
by: Ian Davies | last post by:
Hello all The following code allows me to connect to a local MySQL database on my pc from a VB6 project. **************************************************************************** ** Dim...
2
by: news | last post by:
We currently have our mySQL server on the same box as the Apache server. For security and load balancing, we're going to be moving the mySQL server to another box. We're already using a single...
4
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using...
1
by: mm | last post by:
I have several korn shell scripts I use with a MySQL database on the same server (Solaris). I am moving to a Linux environment where the MySQL database is on another server. I would like to...
3
by: Paradox Synthesist | last post by:
hi, i am a newbie to asp.net and have started learning mainly from websites. i have a question which IS very silly and trivial. ...
5
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql server with java application but when i try to compile,the compilation is successful and during execution i get the following message, ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.