There are a whole lot of Database platform in the IT world. For instance , Oracle, Firebird, Sybase etc. I only choose
two of them in this tutorial, they are mysql and postgresql. Mysql is a open source project. It is a most popular database component in the personal hosting service. It can work very well with PHP together. And, postgresql is also a open source project base on the BSD license. It’s an object-relational database system. compare with mysql. postgresql is more powerful feature like Views, Triggers, and Unions. on the other hand, the speed of mysql is faster than postgresql.
The ports system also will be used in building database. make sure your ports system has been update. and versions of mysql and postgresql need be latest.
1. MySQL 5.1
First of all, changing to root user by command “su”.
1.1 Installation MySQL5.1
Then, changing to mysql ports directory to install mysql 5.1.
$ cd /usr/ports/databases/mysql51-server/
$ make install clean
You can use following option. For example: 1.2 Start MySQL server 1.3 Configuration MySQL 2.1 Installation PostgreSQL 8.3 add several new lines after finish installation in the file of "/etc/rc.conf" 2.2 Configuration A simple database should be created by user "pgsql". Last but not least, start server:
</code><code>WITH_CHARSET=charset Define the primary built-in charset (latin1).
WITH_XCHARSET=list Define other built-in charsets (may be 'all').
WITH_COLLATION=collate Define default collation (latin1_swedish_ci).
WITH_OPENSSL=yes Enable secure connections.
WITH_LINUXTHREADS=yes Use the linuxthreads pthread library.
WITH_PROC_SCOPE_PTH=yes Use process scope threads
(try it if you use libpthread).
BUILD_OPTIMIZED=yes Enable compiler optimizations
(use it if you need speed).
BUILD_STATIC=yes Build a static version of mysqld.
(use it if you need even more speed).
WITH_NDB=yes Enable support for NDB Cluster.</code></code></code></code>
</code><code>$ make WITH_CHARSET=utf8 WITH_XCHARSET=all
WITH_COLLATION=utf8_unicode_ci BUILD_OPTIMIZED=yes
install clean</code></code></code></code>
after a long time of waiting.you could start mysql server. add a line in the "/etc/rc.conf"
</code><code>mysql_enable="YES"
and. using command start server.
</code><code>$ /usr/local/ect/rc.d/mysql-server start
set the password of root user.
</code><code>$ mysql -u root -p
2. PostgreSQL
Keeping you currently in the root account.
</code><code>$ /usr/ports/databases/postgresql83-server
make config install clean
The you can choose model that you need in the Configuration interface.
</code><code>postgresql_enable="YES"
postgresql_data="/var/db/pgsql/data" # you can change to your location
postgresql_flags="-w -s -m fast"
postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
postgresql_class="default"
make sure you have /var/db/pgsql/data directory in your location, if you do not have this directory. you need creat it by root account and change owner to user "pgsql" by command "chown". such as:
</code><code>mkdir /var/db/pgsql/data
chown pgsql:pgsql /var/db/pgsql/data
</code><code>$ su pgsql // using the root account to do this
$ initdb -D /var/db/pgsql/data
$ createuser -p //change the password of database user "pgsql".</code><code>
</code><code>$ /usr/local/etc/rc.d/postgresql start
Next, we will build PHP development environment with Apache2 in the DesktopBSD.
To be continued...