安装mysql数据库
如果你下载的是源码,按如下方式安装
# pw groupadd mysql
# pw useradd mysql -g mysql -s /nonexitent
# tar -zxvf mysql-4.0.20.tar.gz
# mv mysql-4.0.20.tar.gz mysql
# cd mysql
# ./configure --prefix=/usr/local/mysql
# make
# make install
# scripts/mysql_install_db
# chown -R root /usr/local/mysql
# chown -R mysql /usr/local/mysql/var
# chgrp -R mysql /usr/local/mysql
# cp support-files/my-medium.cnf /etc/my.cnf
# /usr/local/mysql/bin/safe_mysqld --user=mysql &
# echo "/usr/local/mysql/bin/safe_mysqld --user=mysql &" > /etc/rc.local
# ./mysqladmin -u root -p password "your-password"
已编译包安装方法如下:
shell> pw groupadd mysql
shell> pw useradd mysql -g mysql -s /nonexitent
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root /usr/local/mysql
shell> chown -R mysql /usr/local/mysql/data
shell> chgrp -R mysql /usr/local/mysql
shell> chown -R root /usr/local/mysql/bin
shell> bin/safe_mysqld --user=mysql &
# echo "/usr/local/mysql/bin/safe_mysqld --user=mysql &" >> /etc/rc.local
还是注意Mysql的权限比较好
如果mysqld不能执行的话
# chmod 755 /usr/local/mysql/libexec/mysqld
basedir: /usr/local/
datadir: /var/db/mysql/
tmpdir: /var/tmp/
language: /usr/local/share/mysql/english/
pid file: /var/db/mysql/route.pid
TCP port: 3306
Unix socket: /tmp/mysql.sock