Instalasi Mysql Server

| Tuesday, February 20, 2007

MySQL install :

Download binary mysql-5.0.21.tar.gz
# tar xvf mysql-5.0.21.tar.gz
# cd mysql-5.0.21
# ./configure --prefix=/opt/mysql --with-mysqld-user=mysql
# make all && make install

# Install the base database
/opt/mysql/bin/mysql_install_db
# Add a “mysql” user to your system: (MySQL should not need to run as root!)
pw groupadd mysql
pw useradd mysql -g mysql


# Set permissions to correct owner
chown -R mysql:mysql /opt/mysql/

# Start the server
/opt/mysql/bin/mysqld_safe &

# Perform Basic Checks
/opt/mysql/bin/mysqladmin version
/opt/mysql/bin/mysqladmin variables

# Set a Password!
/opt/mysql/bin/mysqladmin -u root password wekQ

# Add a "database" user with password and grant that user permission to connect
/opt/mysql/bin/mysql --user=root --password mysql
wekQ

GRANT ALL PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY 'wekQ' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO mysql@"%" IDENTIFIED BY 'wekQ' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

# Run some tests before going into production (optional)
/opt/mysql/mysql-test/mysql-test-run --force


Copy and test the "rc" boot time startup script
# Copy the "rc" startup script
cp /usr/src/mysql-5.0.21/support-files/mysql.server /usr/local/etc/rc.d/mysql.sh
chmod 755 /usr/local/etc/rc.d/mysql.sh

# Test the "rc" script
/usr/local/etc/rc.d/mysql.sh restart
/usr/local/etc/rc.d/mysql.sh stop
/usr/local/etc/rc.d/mysql.sh start
/usr/local/etc/rc.d/mysql.sh reload

0 komentar: