Tuesday, March 6, 2012

Insert Into User

Hi,

I have an old MySQL code (3.23.41) to insert users into a database:

INSERT INTO user
VALUES('localhost','test',PASSWORD('123'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT INTO db
VALUES('localhost','test','test','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

I have received the following error:
Error 1136:
Column count doesn't match value count at row 1

I already discover that this occurs by an increase number of columns
in later releases.

I´ve found on a forum the following answer to the issue:

insert into user
(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_pri,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv
) values
('your_host','your_username',password('your_password'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

But it is not what I need, as I intent to give no rights on mysql
enviroment and full rights on database.
Before I start to change the 'Y' to 'N' I´m trying to see if someone
can point me into the right direction, or maybe a new way to do this.

Thank you!

No comments:

Post a Comment