`
1028826685
  • 浏览: 939100 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类

mysql-5.1.70linux安装

 
阅读更多

安装前准备

如果MySQL用户不存在,那么添加mysql用户

groupadd mysql
useradd -g mysql 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
 
./configure '--prefix=/usr/local/mysql' '--without-debug' '--with-charset=utf8' '--with-extra-charsets=all' '--enable-assembler' '--with-pthread' '--enable-thread-safe-client' '--with-mysqld-ldflags=-all-static' '--with-client-ldflags=-all-static' '--with-big-tables' '--with-readline' '--with-ssl' '--with-embedded-server' '--enable-local-infile' '--with-plugins=innobase'
 
make
 
make install
 
到此mysql就安装到了/usr/local/mysql路径下,下面开始mysql的配置工作
 
安装mysql选项文件
cp support-files/my-medium.cnf /etc/my.cnf
 
mysql设置开机自启动
cp -r support-files/mysql.server /etc/init.d/mysqld
/sbin/chkconfig --del mysqld
/sbin/chkconfig --add mysqld
 
配置权限表
 
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
 
启动mysql
 
/etc/init.d/mysqld start
 
登陆mysql 
 
mysql -u root -p 
密码默认不输入
 
 
 

这一步可能会报错
/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
 
mysql如何导入旧的数据:
直接拷贝数据库文件夹到数据目录下然后执行
 
/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 默认密码:

 
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics