Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
database create and assign username
Old 01-30-2010, 05:06 AM database create and assign username
Junior Talker

Posts: 2
Name: Nadir Novruzov
Trades: 0
hi. i want to create mysql databse and assign user to it with previlegies.

i can create databse. but cannot assign user to it. can anyone help me?

this is my code.

PHP Code:
<?php
$link 
mysql_connect("localhost""root""")or die("Could not connect: " mysql_error());
print (
"Connected successfully");

$result mysql_query("CREATE DATABASE `palsitet_testuchun` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci",$link)or die("Invalid query: " mysql_error());

/*and user creation and here*/

mysql_close($link);
?>
Please help.
NModern is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-30-2010, 05:21 AM Re: database create and assign username
Junior Talker

Posts: 2
Name: Nadir Novruzov
Trades: 0
i founded it by myself. thank you very much.

<?php
$link = mysql_connect("localhost", "root", "")or die("Could not connect: " . mysql_error());
print ("Connected successfully");

$result = mysql_query("CREATE DATABASE `palsitet_testuchun` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci",$link)or die("Invalid query: " . mysql_error());
$result = mysql_query("CREATE USER 'palsitet'@'localhost' IDENTIFIED BY 'aaa';",$link)or die("Invalid query: " . mysql_error());
$result = mysql_query("GRANT SELECT,INSERT,UPDATE,DELETE ON palsitet_testuchun.* TO 'palsitet'@'localhost';",$link)or die("Invalid query: " . mysql_error());


mysql_close($link);
?>
NModern is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to database create and assign username
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37341 seconds with 12 queries