Linux 基于源码的mysql安装

1、myql下载

  view plain [root@linux download]# wget -c http://mirror.provenscaling.com/mysql/community/source/5.1/mysql-5.1.28-rc.tar.gz

  2、解压缩

  [root@linux download]# tar mysql-5.1.28-rc

  3、编译安装

  view plain [root@linux mysql-5.1.28-rc]# ./configure ――prefix=/usr/local/mysql ――with-extra-charsets=all ――enable-thread-safe-client ――enable-assembler ――with-charset=utf8 ――with-big-tables ――with-readline ――with-ssl ――with-embedded-server ――enable-local-infile配置的具体意义,可以通过。/configure ――help 获取帮助view plain [root@linux mysql-5.1.28-rc]# make && make install 4、添加用户view plain [root@linux mysql-5.1.28-rc]# groupadd mysql

  view plain [root@linux mysql-5.1.28-rc]# useradd -s /sbin/nologin -M -g mysql mysql

  5、编辑配置文件my.cnf view plain <pre name="code" class="plain">[root@linux ~]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf view plain [root@linux ~]# sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf

  6、安装view plain [root@linux ~]# /usr/local/mysql/bin/mysql_install_db ――user=mysql

  7、设置文件宿主view plain [root@linux ~]# chown -R mysql /usr/local/mysql/var

  view plain [root@linux ~]# chgrp -R mysql /usr/local/mysql/.

  8、设置服务view plain [root@linux ~]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql [root@linux ~]# chmod 755 /etc/init.d/mysql

  view plain [root@linux ~]# cat > /etc/ld.so.conf.d/mysql.conf<<EOF

> /usr/local/mysql/lib/mysql
> /usr/local/lib
> EOF

  [root@linux ~]# ldconfig

  view plain [root@linux ~]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql [root@linux ~]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql

  9、启动服务view plain [root@linux ~]# /etc/init.d/mysql start

  view plain [root@linux ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql [root@linux ~]# ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump [root@linux ~]# ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk

  10.设置密码view plain <pre name="code" class="plain">[root@linux ~]# /usr/local/mysql/bin/mysqladmin -u root password 12345 [root@linux ~]# /etc/init.d/mysql restart

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