Someone needs a database on the local mysql server, but you only want this user to access this database.
mysql -u root -p (enter the mysql root password when prompted) create user booga@localhost; alter user booga@localhost identified by 'Boogaspassword'; grant all on mydatabase.* to booga@localhost; flush privileges;
mariadb Root Password
I had some problems setting the root password after initally installing mariadb. “mysqladmin password” does not appear to work any more. I found the following works.
mysql -u root (note I did not put in a password) use mysql; alter user root@localhost identified by 'MyNewRootPassword';
Tested with mariadb-server version 10.5.13
- Create a user in the mysql database. The user will have a username of george and a password of “letmein”.
- Create a database named georgedb
- Give george permission to access that database
mysql create database georgedb; grant select,insert,update,delete,create,drop,references,index,alter on georgedb.* \ to george@localhost identified by 'letmein'; exit;
mysql mysql insert into user(Host, User, Password) values ('localhost','george',password('letmein')); create database georgedb; insert into db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, \ Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv) values ('localhost', \ 'georgedb', 'george', 'Y','Y','Y','Y','Y','Y','N','Y','Y','Y'); exit; mysqladmin reload