mysql在linux上的设置和排错
我的LINUX机器: Linux 2.6.20-2925.9.fc7xen i686 i686 i386 GNU/Linux
内存: 1G
硬盘:120G
MYSQL版本: mysql-6.0.0-alpha.tar.gz
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> mkdir /usr/local/mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-huge.cnf /etc/my.cnf
shell> cd /usr/local/mysql
查看文件中有没有设置本地域名,没有则添加
shell> vi /etc/hosts
add 127.0.0.1 localhost.localdomain localhost
保存
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & //开启MYSQL服务
mysql> GRANT all ON *.* TO root@"%" IDENTIFIED BY 'root';
############################
以下命令用于设置mysql开机自动运行
cd mysql-VERSION
####再次进入解压后的目录,即源码目录。
cp support-files/mysql.server /etc/init.d/mysql
###将mysql.server这个文件copy到/etc/init.d/目录下,并更名为mysql
chmod 755 /etc/init.d/mysql
###给/etc/init.d/mysql这个文件赋予“执行”权限
chkconfig --level 345 mysql on
###加入到开机自动运行,运行级别为3 4 5
service mysql restart
###重启mysql服务 ##{start | stop | restart | reload}
#################
修改/etc/my.cnf
# vi /etc/my.cnf
old: socket=/tmp/mysql.sock
new: socket=/var/lib/mysql/mysql.sock
保存后
# service mysql restart