
Error accediendo a mysql con nuevo usuario
Publicado por centaurux (11 intervenciones) el 29/05/2014 18:51:00
Hola q tal?
Un favor, tengo problemas para conectarme con un nuevo usuario que cree.
con root me conecto sin problema alguno.
pero al querer usar m nuevo usuario tengo el error creee un usuario y tengo el errorERROR 1045 (28000): Access denied for user bla bla bla bla...
aqui pongo los comandos que estoy ejecutando para que me ayuden y si estoy haciendolo mal me lo indiquen por favor.
Saludos
Muchas gracias por su apoyo.
centaurux
Un favor, tengo problemas para conectarme con un nuevo usuario que cree.
con root me conecto sin problema alguno.
pero al querer usar m nuevo usuario tengo el error creee un usuario y tengo el errorERROR 1045 (28000): Access denied for user bla bla bla bla...
aqui pongo los comandos que estoy ejecutando para que me ayuden y si estoy haciendolo mal me lo indiquen por favor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$conmy = mysql_connect($_SESSION['server'], 'root', 'xxxx');
if (!$conmy) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($_SESSION["basesys"],$conmy);
// creo usuario en tabla propia
$insertSQLh = sprintf("insert into usr (userid, passw, name,
status,cia)
values ('%s','%s','%s','%s','%s')",
$xusu, $pwd,$nombre,$esta,$cia);
$Result1 = @mysql_query($insertSQLh, $conmy);
//
// creo usuario en tablas de mysql y agrega privilegios para admin.
//
$conmy = mysql_connect($_SESSION['server'], 'root', 'xxxx');
if (!$conmy) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($_SESSION["basedatomy"],$conmy);
//
$insertSQLh = sprintf("CREATE USER '%s'@'localhost' IDENTIFIED BY '%s'",$xusu,$pwdmy);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on ctrlctl.* to '%s'@'localhost' identified by '%s'
WITH GRANT OPTION",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
//
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.user to '%s'@'localhost' identified by '%s'
WITH GRANT OPTION",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
//
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.tables_priv to '%s'@'localhost' identified by '%s'",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.db to '%s'@'localhost' identified by '%s'",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.proc to '%s'@'localhost' identified by '%s'",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.procs_priv to '%s'@'localhost' identified by '%s'",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("grant select,insert,update,delete,create,drop,alter
on mysql.func to '%s'@'localhost' identified by '%s'",$xusu,$pwd);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("FLUSH PRIVILEGES");
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("update user
set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y',
Delete_priv = 'Y', Create_priv = 'Y', Drop_priv = 'N',
Reload_priv = 'N', Shutdown_priv = 'N', Process_priv = 'N',
File_priv = 'N', Grant_priv = 'Y', References_priv = 'Y',
Index_priv = 'N', Alter_priv = 'N', Show_db_priv = 'N',
Super_priv = 'N', Create_tmp_table_priv = 'N', Lock_tables_priv = 'N',
Execute_priv = 'Y', Repl_slave_priv = 'N', Repl_client_priv = 'N',
Create_view_priv = 'N', Show_view_priv = 'N',Create_routine_priv = 'N',
Alter_routine_priv = 'N', Create_user_priv = 'Y'
where user = '%s'",$xusu);
$Result1 = @mysql_query($insertSQLh, $conmy);
$insertSQLh = sprintf("FLUSH PRIVILEGES");
$Result1 = @mysql_query($insertSQLh, $conmy);
Saludos
Muchas gracias por su apoyo.
centaurux
Valora esta pregunta


0