Howto mariadb server: Difference between revisions
Jump to navigation
Jump to search
Line 18: | Line 18: | ||
DBPASS=mypassword | DBPASS=mypassword | ||
create the database: | create the database: | ||
mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};" | mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};" | ||
create the user and privileges to access from localhost and remote: | 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}'@'localhost' IDENTIFIED BY '${DBPASS}';" | ||
mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'%' IDENTIFIED BY '${DBPASS}';" | mysql -uroot -p${ROOT_PASS} -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'%' IDENTIFIED BY '${DBPASS}';" |
Revision as of 19:57, 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}';"