create database foo;
create user 'foo'@'localhost' identified by 'password';
grant all privileges on foo.* to 'foo'@'localhost';
flush privileges;

--- check:
show grants for 'foo'@'localhost';