Howto mariadb server: Difference between revisions
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 | ||
= | = mariadb administration = | ||
set this variables on your shell or script: | set this variables on your shell or script: | ||
ROOT_PASS="mysqlrootpassword" | ROOT_PASS="mysqlrootpassword" |
Revision as of 21:40, 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
mariadb administration
set this variables on your shell or script:
ROOT_PASS="mysqlrootpassword" DBUSER=mydbuser DBNAME=mydbname DBPASS=mydbpassword
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}';"