安装前准备
如果MySQL用户不存在,那么添加mysql用户
groupadd mysql
useradd
-g mysql mysql
wget http:
//downloads
.mysql.com
/archives/mysql-5
.1
/mysql-5
.1.70.
tar
.gz
tar
-zxvf mysql-5.1.70.
tar
.gz
cd
mysql-5.1.70
yum
install
ncurses ncurses-devel
cp support-files
/my-medium
.cnf
/etc/my
.cnf
/etc/init
.d
/mysqld
start
这一步可能会报错
/etc/init.d/mysqld: line 260: my_print_defaults: command not found
/etc/init.d/mysqld: line 263: my_print_defaults: command not found
/etc/init.d/mysqld: line 270: @HOSTNAME@: command not found
/etc/init.d/mysqld: line 279: @HOSTNAME@: command not found
/etc/init.d/mysqld: line 292: cd: @prefix@: No such file or directory
Starting MySQLCouldn't find MySQL manager (@bindir@/mysqlmanager) or server (@bindir@/mysqld_safe) [FAILED]
因为路径没有设置,请重启确认上面配置工作是否都完成,一般是configure后没有make和make install。
mysql初始化配置:
export
PATH=
/usr/local/mysql/bin
:$PATH
/usr/local/mysql/bin/mysql_secure_installation
直接拷贝数据库文件夹到数据目录下然后执行
/usr/local/mysql/bin/mysqladmin
-u root -p flush-tables
mysql安装过程中问题
1.
make[2]: Entering directory `/down/webinstall/mysql-5.1.57/mysql-test
make[3]: Entering directory `/down/webinstall/mysql-5.1.57/mysql-test
make[3]: Nothing to be done for `install-exec-am.
make INSTALL_TO_DIR="/usr/local/mysql/mysql-test" install_test_files
make[4]: Entering directory `/down/webinstall/mysql-5.1.57/mysql-test
时间较长
MYSQL安装到这里卡了很久,可能以为出错了,实际上MYSQL已经安装成功了,它这步过段时间就会好了,是mysql在自我编译测试造成的。
2.checking for termcap functions library... configure: error: No curses/termcap library found
yum install ncurses ncurses-devel
3.Starting MySQL.Manager of pid-file quit without updating fi[FAILED]
启动数据库之前,需要先配置权限表,其中/usr/local/mysql为mysql的安装目录
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
修改mysql 默认密码: