see mariadb-install
make it production ready and check
mysql_secure_installation
no need to provide password if you’re root@localhost (not sure it’s the one or the other or both)
mariadb -u root
otherwise
mariadb -u root -p
debian/ubuntu - already the default
grep -r bind-address /etc/mysql/
slackware
cp -i /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server.cnf.dist vi /etc/my.cnf.d/server.cnf bind-address = 127.0.0.1 vi /etc/rc.d/rc.mysqld #SKIP="--skip-networking" tail -F /var/lib/mysql/xc.err & /etc/rc.d/rc.mysqld restart
finally check
# returns two lines, tcp and unix netstat -lnp | grep mariadb
create a db with UTF-8 charset & collate e.g. for moodle or keycloak
create database DBNAME default character set utf8 default collate utf8_general_ci;
grant all privileges on DBNAME.* to DBDUDE identified by 'DBDUDE-PASSWORD';
flush privileges;
ls -lF /var/lib/mysql/*.err tail -F /var/lib/mysql/*.err
list databases
show databases;
delete a database
drop database DBNAME;
See Database Character Set and Collation on how to check that the charset is right. That’s a MySQL 5 doc but should also work with MariaDB. On a db,
USE db_name; SELECT @@character_set_database, @@collation_database;
or alternatively without being on that db,
SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'db_name';
The defaults are not right (latin1 instead of utf8),
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
e.g. for root
select user from mysql.user; ALTER USER root@localhost IDENTIFIED BY 'NEW-PASSWORD'; FLUSH PRIVILEGES;
Inject whatever SQL code you want in it,
app=mariadbprod
docker exec -ti $app mysql -udbnameuser -pUSERPASS_HERE dbname < schema.sql
and check,
docker exec -ti $app mysql -udbnameuser -pUSERPASS_HERE dbname show tables; ...
11:15 < TheRealBug[slack]> for table in `mysql -u root -s -N -e “use old_db;show tables from old_db;“`; do `` 11:15 < TheRealBug[slack]> mysql -u root -ppassword -s -N -e “use old_db;rename table old_db.$table to new_db.$table;“; 11:15 < TheRealBug[slack]> done
mariadb networked slackware-64-current https://www.linuxquestions.org/questions/slackware-14/mariadb-networked-slackware-64-current-4175693569/
Configuring MariaDB for Remote Client Access https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/
Create and delete a MySQL database https://gridscale.io/en/community/tutorials/mysql-datenbank-erstellen-loeschen/
How To Reset Your MySQL or MariaDB Root Password https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password
How to Reset the MySQL Root Password https://linuxize.com/post/how-to-reset-a-mysql-root-password/
B.3.3.2 How to Reset the Root Password https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html