MySQL: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 24: Line 24:
CREATE USER 'chorke'@'localhost' IDENTIFIED VIA unix_socket;
CREATE USER 'chorke'@'localhost' IDENTIFIED VIA unix_socket;
GRANT ALL PRIVILEGES ON *.* TO 'chorke'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'chorke'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
DDL
DDL
</syntaxhighlight>
</syntaxhighlight>
Line 34: Line 35:
CREATE USER 'chorke_orgwiki'@'localhost' IDENTIFIED BY 'sadaqah!';
CREATE USER 'chorke_orgwiki'@'localhost' IDENTIFIED BY 'sadaqah!';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'localhost';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'localhost';
FLUSH PRIVILEGES;
DDL
DDL
</syntaxhighlight>
</syntaxhighlight>
Line 45: Line 47:
CREATE USER 'chorke_orgwiki'@'%' IDENTIFIED BY 'sadaqah!';
CREATE USER 'chorke_orgwiki'@'%' IDENTIFIED BY 'sadaqah!';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'%';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'%';
FLUSH PRIVILEGES;
DDL
DDL
</syntaxhighlight>
</syntaxhighlight>

Revision as of 21:18, 4 September 2024

sudo apt-get install mariadb-server mariadb-client
sudo systemctl enable --now mariadb
systemctl status mariadb
mariadb --version
sudo mysql_secure_installation

Authorization

MySQL » Auth » Unix

sudo su
cat << DDL | mysql
CREATE USER 'chorke'@'localhost' IDENTIFIED VIA unix_socket;
GRANT ALL PRIVILEGES ON *.* TO 'chorke'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
DDL

MySQL » Auth » Local

cat << DDL | mysql
CREATE DATABASE IF NOT EXISTS chorke_orgwiki;
CREATE USER 'chorke_orgwiki'@'localhost' IDENTIFIED BY 'sadaqah!';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'localhost';
FLUSH PRIVILEGES;
DDL

MySQL » Auth » Remote

cat << DDL | mysql
CREATE DATABASE IF NOT EXISTS chorke_orgwiki;
CREATE USER 'chorke_orgwiki'@'%' IDENTIFIED BY 'sadaqah!';
GRANT ALL PRIVILEGES ON chorke_orgwiki.* TO 'chorke_orgwiki'@'%';
FLUSH PRIVILEGES;
DDL

References