MySQL5 tar.gz编译安装

至于为什么一定要编译安装这儿就不赘述了。自己可以百度一下编译安装的好处。

下面就是自己安装过程中执行的shell 脚本。

红色部分是自己遇到的错误及解决方案。

更新于 2016年8月2日

# cp mysql-5.1.51.tar.gz /usr/local/src/
# cd /usr/local/src/
# groupadd -r mysql

# useradd -g mysql -r mysql

# gunzip < mysql-5.1.51.tar.gz | tar -xvf -

# cd mysql-5.1.30

出错:没有安装GCC

解决方法:yum install gcc 

yum install gcc-c++
出错:no curses/termcap library found
解决方法; yum install ncurses-devel

# ./configure –prefix=/usr/local/mysql/ –with-unix-socket-path=/tmp/mysql.sock 
# make 
# make install
# cd /usr/local/mysql/
# chown -R mysql .
# chgrp -R mysql .
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql /usr/local/mysql/var/

# cp -f /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
# cp -f /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql.server
# /usr/local/mysql/bin/mysql -V

出错:Starting Mysql.manager of pid-file quit without updating file
解决办法:
把/etc/my.cnf 里的skip-federated注释掉,
再初始化MySQL: #/usr/local/mysql/bin/mysql_install_db --user=mysql
#ln -s /usr/local/mysql/bin/mysql /usr/bin
# /etc/init.d/mysql.server status
# /etc/init.d/mysql.server start
# /usr/local/mysql/bin/mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.51-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

Bye

开放RedHat端口:
#vi /etc/sysconfig/iptables
添加-A INPUT -m state --state NEW -m tvp -p tcp --dport 13306 -j ACCEPT
这句话的位置一定要注意。
重启防火墙:#/etc/init.d/iptables restart
 
修改MySQL端口到13306
编辑/etc/my.cnf
在mysqld 下添加
port=3506
重启服务:
#/etc/init.d/mysqld restart

#/usr/local/mysql/bin/mysqladmin -u root -p 123@welcome
出错:error: Access denied for user 'root'@'localhost' (using password: YES)  
解决方案:mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'% IDENTIFIED BY '123@welcome' WITH GRANT OPTION;

//进入MySQL服务器
d:\mysql\bin\>mysql -h localhost -u root
//赋予任何主机访问数据的权限
mysql> GRANT   ALL   PRIVILEGES   ON   *.*  TO   'root' @ '%'   WITH   GRANT   OPTION
//使修改生效
mysql>FLUSH  PRIVILEGES
//退出MySQL服务器

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值