I
I
Ian B2015-06-15 20:29:49
PHP
Ian B, 2015-06-15 20:29:49

mysql problem. What about him?

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 ''www.ebalv.ru'.* TO 'ebalv'@'localhost' WITH GRANT OPTION' at line 1
PHP:
mysql_query("GRANT ALL PRIVILEGES ON '{$website}'.* TO '{$user}'@'localhost' WITH GRANT OPTION");if (mysql_error()) {die(mysql_error());}
Technology: nginx+php5-fpm.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya Korablev, 2015-06-15
@swipeshot

Forgive me for offtopic, but I lost with relish from the site address.

A
Andrey Mokhov, 2015-06-15
@mokhovcom

the database name is written without apostrophes, in extreme cases in backticks `dbname`.*

J
Jan B, 2015-06-15
@noobback3

Now there is not even a plug, but it should .. In general, how is it right?
mysql_connect('localhost','root','***');
$rand = md5($password); // $password = mt_rand(0,2000);
if (!is_dir("/home/{$user}")) { mysql_query("CREATE USER '{$user}'@'localhost' IDENTIFIED BY PASSWORD('{$rand}');");if (mysql_error ()) {die(mysql_error());}}
$ws_m = $website; mysql_query("GRANT ALL PRIVILEGES ON `{$website}`.* TO '{$user}'@'localhost' WITH GRANT OPTION;"); if (mysql_error()) {die(mysql_error());}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question