Last active
June 8, 2020 00:40
-
-
Save ryanburnette/432520f4cb659d36e195bb9febf2ddd4 to your computer and use it in GitHub Desktop.
configure MySQL database and user https://ryanburnette.com/blog/mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS databasename; | |
CREATE USER IF NOT EXISTS 'username'@'localhost' IDENTIFIED BY '_not_password_'; | |
ALTER USER 'username'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'localhost'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's my slight variation for idempotent setup, and using mariadb:
setup.sql
:mysql -u root < setup.sql
Also (note to self), what I had to do to install MariaDB 10.4.
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.4/ubuntu $(lsb_release -cs) main" sudo apt update sudo apt -y install mariadb-server mariadb-client sudo mysql_secure_installation