Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a user with the same privileges as root in MySQL/MariaDB? [closed]

Tags:

mysql

People also ask

How do I create a user with all privileges in MariaDB?

Add a user with passwordmysql -uroot -p CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'changeme'; GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; FLUSH PRIVILEGES; exit; If you don't have a user with the sufficient access rights, follow these steps to reset the password.

How do I get all privileges back to the root user in MySQL?

We can restore the MySQL root user full privileges with the help of UPDATE command. Firstly, you need to stop mysqld and restart it with the --skip-grant-tables option. After that, connect to the mysqld server with only mysql (i.e. no -p option, and username may not be required).

How do I create a MariaDB user?

To create a new MariaDB user, type the following command: CREATE USER 'user1'@localhost IDENTIFIED BY 'password1'; In this case, we use the 'localhost' host-name and not the server's IP. This practice is commonplace if you plan to SSH in to your server, or when using the local client to connect to a local MySQL server.


% mysql --user=root mysql
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION;
CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' WITH GRANT OPTION;
CREATE USER 'admin'@'localhost';
GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
CREATE USER 'dummy'@'localhost';
FLUSH PRIVILEGES;