Skip to main content

Permissions / Grants

Grants

GRANT ALL ON *.* TO 'user'@'localhost' IDENTIFIED BY 'somepassword';
GRANT ALL ON database.* TO 'user'@'localhost' IDENTIFIED BY 'somepassword';
GRANT ALL ON database.table TO 'user'@'localhost' IDENTIFIED BY 'somepassword';

GRANT insert ON *.* TO 'user'@'localhost' IDENTIFIED BY 'somepassword';
GRANT select ON database.* TO 'user'@'localhost' IDENTIFIED BY 'somepassword';
GRANT insert,select,update ON database.table TO 'user'@'localhost' IDENTIFIED BY 'somepassword';

Reset lost root password

/etc/init.d/mysqld stop

mysqld_safe --skip-grant-tables --skip-networking &
sleep 5
mysql -u root

use mysql;
update user set password=PASSWORD("toor") where User='root';
flush privileges;
quit

/etc/init.d/mysqld restart