Create MySQL Database and User. The following commands show how to create a MySQL database and User on the MariaDB server.
Login to MySQL as Root User:
mysql -u root -p
Enter your root password
Create a Database:
create database if not exists appointments;
Create User:
create user if not exists 'admin';
Assign a database under user:
grant all on appointments.* to 'admin'@'localhost' identified by 'admin';
Assign all databases under a user:
grant all on *.* to 'admin'@'localhost' identified by 'admin';
Logout from MySQL:
exit
Login as Admin User:
mysql -u admin -p
Enter password admin
Show database under the user:
show databases;
Change the database:
use appointments;
Show tables:
show tables;
You can create table insert update delete data form table using SQL
Logn as the root user:
mysql -u root -p
Enter root password
Enter the following SQL command to update the admin user password. here new Password is new_pass
UPDATE mysql.user SET Password=PASSWORD('new_pass') WHERE USER='admin' AND Host='localhost';
Flush the privileges:
FLUSH PRIVILEGES;
Now login as admin:
mysql -u admin -p
Password: new_pass