Howto mariadb server: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
Line 11: Line 11:
connect to your database server:
connect to your database server:
  mysql -u root -h localhost -p
  mysql -u root -h localhost -p
= mysql administration =
set this variables on your shell or script:
ROOT_PASS="myrootpassword"
DBUSER=drupal
DBNAME=drupaldb
DBPASS=mypassword
create the database:
mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};"
create the user and privileges to access from localhost and remote:
mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'localhost' IDENTIFIED BY '${DBPASS}';"
mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'%' IDENTIFIED BY '${DBPASS}';"

Revision as of 19:56, 12 August 2020

install mariadb on archlinux

install the package:

pacman -S mariadb

create the datadir:

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

secure your mariadb installation:

mysql_secure_installation

start and enable mariadb service:

systemctl start mariadb
systemctl enable mariadb

connect to your database server:

mysql -u root -h localhost -p

mysql administration

set this variables on your shell or script:

ROOT_PASS="myrootpassword"
DBUSER=drupal
DBNAME=drupaldb
DBPASS=mypassword

create the database: mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};" create the user and privileges to access from localhost and remote: mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'localhost' IDENTIFIED BY '${DBPASS}';" mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'%' IDENTIFIED BY '${DBPASS}';"