- login to mysql:
su - root;
- list all available databases:
# login & send command to mysql & logout mysql -u root -e 'show databases' -s --skip-column-names # or login mysql -u root -p; # enter command mysql> show databases; +----------------------+ | Database | +----------------------+ | information_schema | | DatabaseXY | | DatabaseXYZ | | mysql | | phpmyadmin | +----------------------+ 7 rows in set (0.00 sec)
information_schema, mysql are system “internal” databases (where the MySQL users etc.) are stored.
They are created per default during installation.
- create new mysql user called “user” and a database called “databasename” @ localhost and grant the user all access rights
CREATE USER 'user'@'localhost' IDENTIFIED VIA mysql_native_password USING '***';
GRANT USAGE ON *.* TO 'user'@'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS `databasename`;
GRANT ALL PRIVILEGES ON `databasename`.* TO 'user'@'localhost';
GRANT ALL PRIVILEGES ON `databasename\_%`.* TO 'user'@'localhost';
the above cheat sheet is a bit incomplete so plz checkout:
https://mariadb.com/wp-content/uploads/2021/08/mariadb-standard-developer_cheat-sheet_1113.pdf
backup here: mariadb-standard-developer_cheat-sheet_1113.pdf
Links:
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!