Welcome! Log In Create A New Profile


MySQL Connect issues

Posted by DesmondMpofu 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
MySQL Connect issues
April 12, 2010 12:37PM
I have be working on a database creation problem with the following code
Language: PHP
<?php //connect to MySQL; note we’ve used our own parameters- you should use //your own for hostname, user, and password $connect = mysql_connect("localhost", "heathwhite", "machead5") or die ("Hey loser, check your server connection."); //create the main database if it doesn’t already exist $create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite") or die(mysql_error()); //make sure our recently created database is the active one mysql_select_db("moviesite"); //create "movie" table $movie = "CREATE TABLE movie ( movie_id int(11) NOT NULL auto_increment, movie_name varchar(255) NOT NULL, movie_type tinyint(2) NOT NULL default 0, movie_year int(4) NOT NULL default 0, movie_leadactor int(11) NOT NULL default 0, movie_director int(11) NOT NULL default 0, PRIMARY KEY (movie_id), KEY movie_type (movie_type,movie_year) )"; $results = mysql_query($movie) or die (mysql_error());   //create "movietype" table $movietype = "CREATE TABLE movietype ( movietype_id int(11) NOT NULL auto_increment, movietype_label varchar(100) NOT NULL, PRIMARY KEY (movietype_id) )"; $results = mysql_query($movietype) or die(mysql_error()); //create "people" table $people = "CREATE TABLE people ( people_id int(11) NOT NULL auto_increment, people_fullname varchar(255) NOT NULL, people_isactor tinyint(1) NOT NULL default 0, people_isdirector tinyint(1) NOT NULL default 0, PRIMARY KEY (people_id) )"; $results = mysql_query($people) or die(mysql_error()); echo "Movie Database successfully created!"; ?>

But upon running it I get the error shown below. My logins are correct and now I can't pinpoint the problem cause. Plz help I feel like a loser now.
Language: PHP
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ';Heath White';@';localhost'; (using password: YES) in /Applications/XAMPP/xamppfiles/htdocs/moviedata.php on line 4 Hey loser, check your server connection.
Re: MySQL Connect issues
April 13, 2010 07:36AM
The user does not have rights to connect to the datbase.... see http://wiki.phpmyadmin.net/pma/user_management.
Re: MySQL Connect issues
April 15, 2010 02:48PM
Forgot my password while playing around. I did try to retrieve it. (start in safe mode,skipping user tables and then update/insert) but the quickest,easiest solution just reinstall.
Re: MySQL Connect issues
April 15, 2010 03:28PM
Seems most web hosts do not allow you to create a database directly through a PHP script. Instead they require that you use the PHP/MySQL administration tools on the web host control panel to create these databases. So I decided to be creating and adding tables on databases that I already have....
avatar Re: MySQL Connect issues
April 16, 2010 08:25AM
so wat u mean Desmond is that one need to install mysql on remote server where your website is hosted also?

gbakamela [77234715]
Re: MySQL Connect issues
April 16, 2010 10:31AM
the host server where the site is hosted has to have mysql. Creating a new database and creating user permissions is actually a bit technical and kind of away from the normal PHP business, involving a lot of researching on the web (or Google more specifically).
Sorry, only registered users may post in this forum.

Click here to login