groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar zxvf /root/mysql-5.0.22.tar.gz # MySQL 源代码包的绝对路径
cd mysql-5.0.22
./configure --enable-thread-safe-client --with-unix-socket --with-mysqld-user=mysql --with-charset=gbk --prefix=/usr/local/mysql
make # 这一步时间较长
make WITH_XCHARSET=gbk,bg2312 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/mysqld_safe & # 启动 MySQL
/usr/local/mysql/bin/mysqladmin -u root password ‘new-password‘ # 修改 MySQL root 用户口令
注意:my.cnf内容;sock=/tmp/mysql.sock可能导致你在localhost链接不上数据库(mysql -u root -p)客户端命令。。。。sock=/tmp/mysql.pid我修改了。。。
时间: 2024-10-12 10:08:53