MySQL Quick Installation on FreeBSD
Quick installation of MySQL Database on FreeBSD Server. Make sure you are on the latest FreeBSD Port Tree with portsnap, refer to keeping update ports. If you want to browse through what version of MySQL is available in FreeBSD;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
shell> cd /usr/ports shell> make search name=mysql | less shell> Port: mysql-server-5.1.34 Path: /usr/ports/databases/mysql51-server Info: Multithreaded SQL database (server) Maint: ale@FreeBSD.org B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-5.1.34 R-deps: mysql-client-5.1.34 WWW: http://www.mysql.com/ Port: mysql-client-6.0.10 Path: /usr/ports/databases/mysql60-client Info: Multithreaded SQL database (client) Maint: ale@FreeBSD.org B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 R-deps: WWW: http://www.mysql.com/ Port: mysql-scripts-6.0.10 Path: /usr/ports/databases/mysql60-scripts Info: Multithreaded SQL database (scripts) Maint: ale@FreeBSD.org B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10 perl-5.8.9_2 R-deps: mysql-client-6.0.10 p5-DBD-mysql60-4.010 p5-DBI-1.60.7 p5-Storable-2.18 perl-5.8.9_2 WWW: http://www.mysql.com/ Port: mysql-server-6.0.10 Path: /usr/ports/databases/mysql60-server Info: Multithreaded SQL database (server) Maint: ale@FreeBSD.org B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10 R-deps: mysql-client-6.0.10 WWW: http://www.mysql.com/ |
MySQL Installation with FreeBSD Port
We will take MySQL5.0 as example, to install
1 2 3 4 5 6 7 8 |
shell> cd /usr/ports/databases/mysql50-server/ shell> make install clean distclean |
It will take 5-15 minutes for installation and compile time. If you have any error during compiling MySQL, please do not hesitate to post in the comment box here.
You don’t have to run mysql_install_db, to before starting MySQL, put this lines in /etc/rc.conf file;
1 2 3 4 5 6 7 8 |
mysql_enable="YES" mysql_dbdir="/opt/database/mysql" # define your own DB Dir. |
To start MySQL
1 2 3 4 5 6 7 8 9 10 11 |
shell> /usr/local/etc/rc.d/mysql-server start 090605 8:56:26 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 090605 8:56:26 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 090605 8:56:27 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 090605 8:56:27 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 |
You will see the warning messages for the first time of launching MySQL Server, just another warning message.
Customize MySQL’s my.cnf File and Post Install
MySQL’s default my.cnf file is available at /usr/local/share/mysql, copy the cnf file which suit your usage to the database data directory you have defined earlier on /etc/rc.conf. Stop and start MySQL if you make any changes on my.cnf file.
By default, MySQL doesn’t set password for system root account, it’s advice to set a password for your MySQL’s root account;
1 2 3 4 5 6 7 |
shell> mysqladmin -u root password <your password 123> |
Now, you can access to your MySQL database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
shell> mysql -u root -p (enter your password when prompt) shell> Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.0.77 FreeBSD port: mysql-server-5.0.77_1 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) |
If you do not want to use root, you can create an account by your own username;
1 2 3 4 5 6 7 8 |
mysql> CREATE USER 'huhu'@'localhost' IDENTIFIED BY 'your_password'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'huhu'@'localhost' WITH GRANT OPTION; |
That’s the quick install of MySQL5 on FreeBSD Server, it’s quick isn’t it?
Thanks for the tips, I just got my MySQL server running in BSD8.0