Rabu, 07 Oktober 2009

Install MySQL Server

First you need to login as root or run su in order to get the required permissions.
Then navigate to the ports folder for MySQL:

cd /usr/ports/databases/mysql50-server

Now run:

make install clean

in order to download and install MySQL.
Once the install is finished we install the databases by running:

mysql_install_db --user=mysql

If you get an error, run rehash in order to update FreeBSD's path environment variables.
Once this is done we want to grant permissions to the mysql user in /var/db/mysql.

chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/

Now we can start MySQL by running:

/usr/local/bin/mysqld_safe -user=mysql &

Since we probably want MySQL to start after a reboot we will drop a line to /etc/rc.conf

echo 'mysql_enable="YES"' >> /etc/rc.conf

By default MySQL's root account has no password, so we need to change it (If we want our system to be somewhat secure). To change the password for root we enter the following command:

mysqladmin -u root password newpassword

...where newpassword is the password of our choice.

Now we can start making use of our new database server.

If you want to tweak your machine there are different configuration files you can use with your MySQL Server depending on load and what it will be used for. They are located in /usr/local/share/mysql and are called:

my-huge.cnf
my-innodb-heavy-4G.cnf
my-large.cnf
my-medim.cnf
my-small.cnf

We make an example with my-medium.cnf and copy it to /var/db/mysql as my.cnf.

cp /usr/local/share/mysql/my-medim.cnf /var/db/mysql/my.cnf

2 komentar:

nyuwun komentar... . .

za.IPAN's Blog © 2008. Design by :Yanku Templates Sponsored by: Tutorial87 Commentcute