安装MySQL,到 http://www.mysql.com 下载5.1.x最新的Community版本的tar.gz文件到/usr/local/src/,进入目录,用以下参数解压编译安装:
解压
# cd /usr/local/src/ # tar -zxvf mysql-5.1.x.tar.gz
预处理
# cd mysql-5.1.x # ./configure --prefix=/usr/local/mysql \ --without-debug \ --enable-thread-safe-client \ --enable-assembler \ --enable-profiling \ --with-mysqld-ldflags=-all-static \ --with-client-ldflags=-all-static \ --with-charset=utf8 \ --with-extra-charsets=all \ --with-plugins=max \ --with-mysqld-user=mysql
编译安装
# make # make install # groupadd mysql # useradd -g mysql mysql # cd /usr/local/mysql # chown -R mysql . # chgrp -R mysql . # bin/mysql_install_db --user=mysql
启动
# bin/mysqld_safe --user=mysql &
也可以通过建立符号连接来启动:
# ln -s /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld # service mysqld start
将mysqld设成随机启动
# chkconfig --add mysqld # chkconfig --level 345 mysqld on
设置root密码
# /usr/local/mysql/bin/mysqladmin -u root password 123456 (123456为root密码)
给root用户开启mysql远程访问权限
# bin/mysql –u root –p
输入密码登录
mysql> grant all privileges on *.* to root@'%' identified by '123456'; mysql> flush privileges; mysql> exit;