LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-04-2010, 11:36 PM   #1
zubat123
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Rep: Reputation: 0
LAMP question. How to create new database from PHP, SQL


Actually, I am now able to create the database using PHP and SQL. But it seems I can only do it as MySQL root user.. $dbuser = 'root'; but is there a way to do that as a regular MySQL user?

Last edited by zubat123; 11-05-2010 at 01:21 AM.
 
Old 11-05-2010, 01:34 AM   #2
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
Create a new user and grant CREATE privilege for it.
 
Old 11-05-2010, 01:38 AM   #3
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Not without giving the regular user extra privileges. It is a better idea to create the database manually first as root, then create a user with the minimum privileges required that can create/modify/delete tables within that database. Your script can then do all it needs to, but can't affect any other databases.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How does PHP/SQL database do it? puppymagic Linux - Newbie 8 03-11-2010 06:33 AM
My SQL statement to delete an entry in MYSQL database fails in PHP ratchie Linux - Software 1 12-29-2008 02:48 AM
My SQL 1045 error : couldn't create database lin_myworld Linux - Server 1 12-23-2007 09:18 AM
php trying to connect to local sql, error no such database feetyouwell Programming 11 02-08-2005 12:25 PM
How to create a SQL Database in Linux? Phonics3k Programming 4 08-16-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration