Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:25:01+00:00 2026-06-18T00:25:01+00:00

I want to ask about create user and database from PHP Code. I have

  • 0

I want to ask about create user and database from PHP Code.

I have cpanel at server. At my application, I want my app create a database to backup something. But I always get error “access denied”

So, how to create a database and assign user to that database so this user can access it.

My code right now is:

<?php
$con = mysql_connect("localhost","k3516438_disp","secret");
mysql_query("GRANT ALL PRIVILEGES ON *.* TO  'k3516438_disp'@'localhost' IDENTIFIED BY PASSWORD 'secret' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

if (mysql_query("CREATE DATABASE IF NOT EXISTS k3516438_dispatcher_backup",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}

mysql_select_db("universal_backup", $con);

$sql = "CREATE TABLE order_backup
(
order_id varchar(15),
request_id varchar(15)
)";

mysql_query($sql);
?>

And it still not works, that code I have write is from this: problem. But it doesn’t work for me, I thought. Sorry for my Bad English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:25:02+00:00Added an answer on June 18, 2026 at 12:25 am

    Finally I backup it from local (my office), remote the database. Because at local there’s no problem to that privileges. Thanks for all respond to this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i just want to ask about my html code here, i have a bit
I want to ask a question about the UINavigationController on iPhone application. I create
I want to ask about strcpy. I got problem here. Here is my code:
I want to ask a question about the iPhone application. In my program, I
I want to create an web app which can get info about favourist, or
want to ask about NSDate Formatter i want to create Date and time like
I'm writing a database access app for storing some data and want to ask
I want to ask you about best rails way to create a menu. I
I want to ask about an edge-case scenario that I understand is very poor
I want to ask about this function in matlab dicomread example : a =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.