linux下mysql源码安装

    下载安装文件:    mysql-5.1.14-beta-linux-i686-glibc23.tar.gz
     安装步骤如下:
     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> cd /usr/local
     shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
     shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
     shell> cd mysql
     shell> scripts/mysql_install_db --user=mysql
     shell> chown -R root  .
     shell> chown -R mysql data
     shell> chgrp -R mysql .
     shell> mkdir /var/run/mysqld
     shell> chown -R mysql.mysql /var/run/mysqld
     shell> bin/mysqld_safe --user=mysql &
    源码编译安装:     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
     shell> cd mysql-VERSION
     shell> ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/var  --with-charset=gb2312
     shell> make
     shell> make install
     shell> cp support-files/my-medium.cnf /etc/my.cnf
     shell> cd /usr/local/mysql
     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 &
 
 
     #如果你修改数据库密码是碰到了socket '/tmp/mysql.sock' 错误 ,则你需要执行

    #下面这个命令,mysql安装后的mysql.sock默认路径是/var/lib/mysql/mysql.sock 

     [root@localhost mysql]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

你可能感兴趣的:(linux,mysql,数据库,职场,休闲)