Mysql install: Difference between revisions
From wikinotes
(Created page with "= Linux = <blockquote> <syntaxhighlight lang="bash"> sudo pacman -S mariadb mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql sudo systemctl enable mariadb...") |
(→Docker) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= | = Archlinux = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 12: | Line 12: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Linux --> | </blockquote><!-- Linux --> | ||
= Docker = | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:5.7 | |||
</syntaxhighlight> | |||
</blockquote><!-- Docker --> | |||
= FreeBSD = | = FreeBSD = | ||
Line 19: | Line 26: | ||
echo "MYSQL_ENABLE=\"YES\"" >> /etc/rc.conf | echo "MYSQL_ENABLE=\"YES\"" >> /etc/rc.conf | ||
sudo service mysql-server start | sudo service mysql-server start | ||
</syntaxhighlight> | |||
Starting with mysql-5.7, a temporary root password is assigned.<br> | |||
You must reassign it to use the database. | |||
<syntaxhighlight lang="bash"> | |||
mysql -u root --password=$(cat /root/.mysql_secret | tail -n1) | |||
ALTER USER `root`@`localhost` IDENTIFIED BY 'some-password'; | |||
FLUSH PRIVILEGES; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- FreeBSD --> | </blockquote><!-- FreeBSD --> |
Latest revision as of 04:09, 11 September 2022
Archlinux
sudo pacman -S mariadb mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql sudo systemctl enable mariadb sudo systemctl start mariadb ## you can then modify the database as the user `root` ## `mysql -u root`
Docker
docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:5.7
FreeBSD
sudo pkg install mysql57-server echo "MYSQL_ENABLE=\"YES\"" >> /etc/rc.conf sudo service mysql-server startStarting with mysql-5.7, a temporary root password is assigned.
You must reassign it to use the database.mysql -u root --password=$(cat /root/.mysql_secret | tail -n1) ALTER USER `root`@`localhost` IDENTIFIED BY 'some-password'; FLUSH PRIVILEGES;