Friday, December 21, 2018

MySQL server 5.7 installation of freeBSD 12

(It is recommended that to install MySQL before the installation of PHP_extension to avoid old extension installation.)

Method #1. Install using port: (not working!)
# cd /usr/ports/databases/mysql80-server && make install clean BATCH=yes

(By default, we will compile the software from source, it is not built in static. According to MySQL documentation, building the binary using static will result a 13% improvement comparing to building the binary using dynamic. Here is an example how to build MySQL with static option enabled)

# make BUILD_OPTIMIZED=yes BUILD_STATIC=yes
# make install clean
(It takes ...time hr)

/etc/rc.conf
mysql_enable="YES"
# sysrc apache24_enable=yes

Method #2, Installusing pkg:
# pkg update
# pkg upgrade
# pkg install mysql57-server mysql57-client
# sysrc mysql_enable="yes"
# service mysql-server start


MySQL secure installation:
(Note the password)
# cat $HOME/.mysql_secret
yFH&pek0yw3

# mysql_secure_installation
Answer them all with ...y
# mysql -u root -p 
password: yFH&pek0yw3
root@localhost [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yFH&pek0yw3';
root@localhost [(none)]> show databases;

Create a user / database in MySQL:
GRANT ALL PRIVILEGES ON *.* TO 'jira'@'localhost' IDENTIFIED BY 's@ydrfD34FEds';
exit
# mysql -u jira -p
CREATE DATABASE jira;

Check the latest version of the MySQL:
# mysqladmin -u root -p version

Start/Stop:
# sudo /usr/local/etc/rc.d/mysql-server start
# service mysql-server start
# sudo /usr/local/etc/rc.d/mysql-server start

Link:
Install Portsnap

Ref:
1. How to Install MySQL Server with phpMyAdmin on FreeBSD 11
2. The easiest way to improve the performance of MySQL server on FreeBSD

1 comment: