Howto mariadb server: Difference between revisions
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
= mysql administration = | = mysql administration = | ||
set this variables on your shell or script: | set this variables on your shell or script: | ||
ROOT_PASS=" | ROOT_PASS="mysqlrootpassword" | ||
DBUSER= | DBUSER=mydbuser | ||
DBNAME= | DBNAME=mydbname | ||
DBPASS= | DBPASS=mydbpassword | ||
create the database: | create the database: | ||
mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};" | mysql -uroot -p${ROOT_PASS} -e "CREATE DATABASE ${DBNAME};" |
Revision as of 20:01, 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="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}';"