centos5.5中安装mysql5.5.3

前端之家收集整理的这篇文章主要介绍了centos5.5中安装mysql5.5.3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.挂载linux的光盘源

mount /dev/cdrom /media/
cd /etc/yum.repos.d/
rm -rf CentOS-Base.repo
vim CentOS-Media.repo

baseurl=file:///media
gpgcheck=0
enabled=1

2.安装编译MysqL源码必需的程序

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

3.编译安装MysqL

./configure –prefix=/usr/local/MysqL –without-debug –enable-thread-safe-client –with-pthread –enable-assembler –enable-profiling –with-MysqLd-ldflags=-all-static –with-client-ldflags=-all-static –with-extra-charsets=all –with-plugins=all –with-MysqLd-user=MysqL –without-embedded-server –with-server-suffix=-community –with-unix-socket-path=/tmp/MysqL.sock && make && make install

4.创建MysqL用户

useradd MysqL

5.设置MysqL安装目录的权限给MysqL用户

setfacl -m u:MysqL:rwx -R /usr/local/MysqL
setfacl -m d:u:MysqL:rwx -R /usr/local/MysqL

6.安装MysqL和test数据库

/usr/local/MysqL/bin/MysqL_install_db –user=MysqL

7.启动MysqL服务

/usr/local/MysqL/bin/MysqLd_safe –user=MysqL &

8.修改MysqL的登陆密码为123

/usr/local/MysqL/bin/MysqLadmin -uroot password “123”

9.使用MysqL用户登陆数据库

/usr/local/MysqL/bin/MysqL -uroot -p123

10.备份配置MysqL配置文件

cp /usr/local/MysqL/share/MysqL/my-medium.cnf /etc/my.cnf

11.配置MysqL配置文件

vi /etc/my.cnf

#修改客户端的连接字符集
default-character-set=utf8
#修改服务器和数据库字符集
character-set-server=utf8
#修改服务器校验字符集
collation-server=utf8_general_ci

12.重启MysqL服务,让字符集生效

pkill MysqLd /usr/local/MysqL/bin/MysqLd_safe –user=MysqL &

猜你在找的CentOS相关文章