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

  • SEARCH
  • Home
  • 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 8100465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:44:31+00:00 2026-06-05T22:44:31+00:00

<?php $user = substr(md5(rand()),0,16); $pass = substr(md5(rand()),0,20); $query = CREATE USER ‘{$user}’@’%’ IDENTIFIED BY

  • 0
<?php
$user = substr(md5(rand()),0,16);
$pass = substr(md5(rand()),0,20);
$query = "CREATE USER '{$user}'@'%' IDENTIFIED BY '{$pass}'; 
GRANT USAGE ON * . * TO '{$user}'@'%' IDENTIFIED BY '{$pass}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; 
CREATE DATABASE IF NOT EXISTS `{$user}`; 
GRANT ALL PRIVILEGES ON `{$user}` . * TO '{$user}'@'%';";
mysql_connect("***.****.info", "***", "****") or die(mysql_error());
mysql_query($query) or die(mysql_error());
?>

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘GRANT USAGE ON *.* TO ’78eb50407b017587’@’%’ IDENTIFIED BY
‘4fa70f7cc25ccf9dc9dd’ at line 1.

Anyone know what’s going on here

Update I removed identified by and it did nothing. Any other suggestions?

  • 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-05T22:44:32+00:00Added an answer on June 5, 2026 at 10:44 pm

    mysql_query() doesn’t support multiple query. Do the query one by one.

    mysql_connect("***.****.info", "***", "****") or die(mysql_error());
    $query1 = "CREATE USER '{$user}'@'%' IDENTIFIED BY '{$pass}';";
    $query2 = "GRANT USAGE ON * . * TO '{$user}'@'%' IDENTIFIED BY '{$pass}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;";
    $query3 = "CREATE DATABASE IF NOT EXISTS `{$user}`;";
    $query4 = "GRANT ALL PRIVILEGES ON `{$user}` . * TO '{$user}'@'%';";
    mysql_query($query1) or die(mysql_error());
    mysql_query($query2) or die(mysql_error());
    mysql_query($query3) or die(mysql_error());
    mysql_query($query4) or die(mysql_error());
    

    But, given the structure of your query, I would suggest you to do a transactions query. You can read more about it, here:

    • PHP + MySQL transactions examples
    • PHP & mySQL: Simple code to implement Transaction – Commit & Rollback
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a php form that for registering the user and store
My app uploads an image and user/email/pass upon registration. iOS to php to mySQL.
This is user.php: include(databse.php);//retrieving successfully first name and lastname from databse file into user.php
i created a model object in PHP class User { public $title; public function
I've set up a CRON to call a URL in Kohana 3. php /home/user/public_html/index.php
i've set the rules, RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)/?$ user.php?userid=$1 it
How to determine the browser of the user using PHP? So that if the
I am trying to make a check in PHP if a user changes their
I want to run a particular block of PHP if the user submits a
Hi Masters of Web Programing. I've got this code: <?PHP $db_user = 'user'; $db_pass

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.