Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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

  #2 (permalink)  
Old January 25th, 2007, 04:23 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 479
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
  #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



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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.