View Full Version : mysql connect
I have this code:
$link = mysql_connect('localhost', 'TV', 'functiontest')or die('Error connecting to mysql');
mysql_select_db("TV",$link);
I connect with mysql editor is ok
but when i connect by this code it said that:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'TV'@'localhost' (using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\coppydata\copy.php on line 3
Error connecting to mysql
JasonDFR
03-05-2009, 01:45 PM
#
MySQL is a database management system.
A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network. To add, access, and process data stored in a computer database, you need a database management system such as MySQL Server. Since computers are very good at handling large amounts of data, database management systems play a central role in computing, as standalone utilities, or as parts of other applications.
???
Fill in the $username and the $password below and run this code:
<?php
$server = 'localhost';
$username = '';
$password = '';
$link = mysql_connect($server, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
If this doesn't work, all you can do is make certain you have the right values for $server, $username, and $password. The file you are running is on your C: drive. Are you sure there is a MySQL server with your username on the same machine as the script?
Thank u for your help
But my database is not store in local, it store on my server.
mysql_connect("host", "user", "pass")
Make sure that your host, user, and password are correct!! (Check in your cpanel for host)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.