User Tools

Site Tools


apps:mysql

MySQL

Create new User+DB

Create a database with a user which have full access.

Example data:

  • Username: u_example
  • Password: WXJ07sf7lO7X4kzxjA47j7diQ4Z309628XS3Xm5D1L
  • Databasename: db_example

Notes:

  • I use prefix u_ for users and prefix db_ for databases that I never mix them up.
  • I recommend passwords with 64 characters. They can be generated on https://pwgen.ch/ for example.
CREATE USER 'u_example'@'localhost' IDENTIFIED BY 'WXJ07sf7lO7X4kzxjA47j7diQ4Z309628XS3Xm5D1L';
CREATE DATABASE db_example;
GRANT ALL PRIVILEGES ON db_example.* TO 'u_example'@'localhost';
FLUSH PRIVILEGES;

Delete DB+USer

Example data:

  • Username: u_example
  • Databasename: db_example
DROP DATABASE db_example;
DROP USER u_example@'localhost';

Caching

To make use of the MySQL query cache, the statements have to be exactly the same (including case):

Following statements are treated differently by the cache but deliver the same results:

  • SELECT * FROM tbl_name
  • select * FROM tbl_name
  • select * from tbl_name

More details: How the Query Cache Operates

apps/mysql.txt · Last modified: 2023-01-02 18:10 by Manuel Frei