Setting up MySQL
Installing MySQL
Either install MySQL or MariaDB. To Install MariaDB, you can follow our guide.
Creating a MySQL User
- Enter the MySQL shell by typing
mysql
in your terminal - Create a database, the following example is creating a database called
your_database
:
CREATE USER 'your_user'@'127.0.0.1' IDENTIFIED BY 'somePasswordHere';
Creating a MySQL Database
- Enter the MySQL shell by typing
mysql
in your terminal - Create a user, the following example is creating a user called
your_user
:
CREATE DATABASE your_database;
Setting MySQL User Privileges
This documentation page aims to provide a user-friendly guide on how to manage user permissions in MySQL.
Granting All Permissions to a User on a Specific Database
To assign all permissions to the user your_user
on the your_database
database, follow these steps:
GRANT ALL PRIVILEGES ON your_database.* TO 'your_user'@'127.0.0.1';
This command grants the user your_user
full access to perform any operation on the specified database.
Granting All Permissions to a User on All Databases
If you want to grant all permissions to the user your_user
on all databases, use the following command:
GRANT ALL PRIVILEGES ON *.* TO 'your_user'@'127.0.0.1' WITH GRANT OPTION;
This command assigns the user your_user
with privileges across all databases. It enables the user to perform any operation on any table within any database. The “WITH GRANT OPTION” allows this user to grant or revoke privileges for other users.
If you need to allow connection from a remote IP, please follow our remote connection guide.