Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2007, 01:16 AM
Registered User
 
Join Date: Jan 2007
Location: madurai, tn, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default create database in mysql through php coding

<?php
$con = mysql_connect("localhost","vivek","vivek");
echo $con;
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }if (mysql_query("CREATE DATABASE vivek1",$con))
  {
  echo "Database created";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }mysql_close($con);
?>
i am using this code iam getting error like this

Resource id #2Error creating database: Access denied for user 'vivelk'@'localhost' to database 'vivek1'

can any body help me

Reply With Quote
  #2 (permalink)  
Old January 25th, 2007, 04:23 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 481
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hai vivekananth,
your user name amd password do not have permission to create databse using your access level.
so, better to use root user name password for create databse query.

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
Reply With Quote
  #3 (permalink)  
Old January 31st, 2007, 01:48 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

need to change the user privilege;
such as:
mysql>grant all privileges on *.* to vivec@localhost

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
entering £ (pound sign) into MySQL database - PHP crmpicco PHP Databases 1 November 14th, 2007 02:02 AM
PHP Create Database problem sweyhrich Beginning PHP 9 January 29th, 2007 06:39 AM
Create Crystal Report using Php, Mysql arry004 PHP How-To 0 September 27th, 2006 05:16 AM
Create MySQL database newlearner PHP Databases 7 June 15th, 2005 03:26 AM
Interfacing PHP/MYSQL to existing Database... mekh Pro PHP 6 February 8th, 2004 06:04 PM



All times are GMT -4. The time now is 11:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.