Linux下安装mysql-5.1.68.tar
系统环境是Centos5.8的
因为mysql5.5.*以上版本需要安装cmakce
现在安装这个5.1.*版本的数据库
1.首先创建账户和用户组
groupadd mysql
useradd -g mysql mysql
2.解压包
tar xvfz mysql-5.1.68.tar.gz
cd mysql-5.1.68
进入mysql-5.1.68目录,执行configure并执行一些参数
./configure --prefix=/usr/local/mysql/ --with-server-suffix=-
junsansi-edition --enable-assembler --enable-local-infile --
enable-thread-safe-client --with-big-tables --with-charset=utf8
--with-extra-charsets=gbk,gb2312,utf8,ascii --with-readline
--with-ssl --with-embedded-server --with-pthread --with-
mysqld-user=mysql --with-mysqld-ldflags=-all-static --with-
client-ldflags=-all-static --with-
plugins=partition,innobase,innodb_plugin
提示:configure支持的选项非常多,详细的参数及说明建议参考官方文
档,也可以通过./configure --help查看,这里仅列出常用及推荐使用
的选项。
--prefix=PREFIX:指定程序安装路径;
--enable-assembler:使用汇编模式;
--enable-local-infile:启用对LOAD DATA LOCAL INFILE语法的支持(
默认不支持);
--enable-profiling:Build a version with query profiling code
(req.community-features)
--enable-thread-safe-client:使用编译客户端;
--with-big-tables:启用32位平台对4G大表的支持;
--with-charset=CHARSET:指定字符集;
--with-collation=:默认collation;
--with-extra-charsets=CHARSET,CHARSET,...:指定附加的字符集;
--with-fast-mutexes:Compile with fast mutexes
--with-readline:
--with-ssl:启用SSL的支持;
--with-server-suffix=:添加字符串到版本信息;
--with-embedded-server:编译embedded-server;
--with-pthread:强制使用pthread类库;
--with-mysqld-user=:指定mysqld守护进程的用户;
--with-mysqld-ldflags=:静态编译MySQL服务器端;
--with-client-ldflags=:静态编译MySQL客户端;
--with-plugins=PLUGIN,PLUGIN,...:MySQL服务器端支持的组件(默认
为空),可选值较多:
partition:MySQL Partitioning Support;
daemon_example:This is an example plugin daemon;
ftexample:Simple full-text parser plugin;
archive:Archive Storage Engine;
blackhole:Basic Write-only Read-never tables;
csv:Stores tables in text CSV format,强制安装;
example:Example for Storage Engines for developers;
federated:Connects to tables on remote MySQL servers;
heap:Volatile memory based tables,强制安装;
ibmdb2i:IBM DB2 for i Storage Engine;
innobase:Transactional Tables using InnoDB;
innodb_plugin:Transactional Tables using InnoDB;
myisam:Traditional non-transactional MySQL tables,强制安装;
myisammrg:Merge multiple MySQL tables into one,强制安装;
ndbcluster:High Availability Clustered tables;
--with-plugin-PLUGIN:强制指定的插件链接至MySQL服务器;
--with-zlib-dir=:向MySQL提供一个自定义的压缩类库地址;
--without-server:仅安装MySQL客户端;
--without-query-cache:不要编译查询缓存;
--without-geometry:不要编译geometry-related部分;
--without-debug:编译为产品版,放弃debugging代码;
--without-ndb-debug:禁用special ndb debug特性;
安装完之后出现以下提示信息
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference
manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
1。使用rpm -qa | grep libtool
我的机子已经安装了
libtool-1.5.22-7.el5_4
如果没安装就安装一下吧
yum install libtool
2 .分别执行以下三条命令:
# autoreconf --force --install
# libtoolize --automake --force
# automake --force --add-missing
再重新编译安装,问题解决!
网上遇到的解决办法
这时直接打开 configure(就在解压的软件包里面),把 $RM
“$cfgfile” 那行删除掉,重新再运行 ./configure 就可以了。
网上所说的那些方法根本不管用,如:
# aclocal
# autoconf
# automake
# libtoolize –force
或者:
# autoreconf –force –install
# libtoolize –automake –force
# automake –force –add-missing
晕死了!网上查的都是一些错误信息,害的我浪费很多时间
config.status: executing default commands
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference
manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
我的解决了,网上也有没解决的,那只能用上面的方法在configure里面
删除 $RM “$cfgfile”这个了
继续执行编译
make & make install
复制配置文件
cp support-files/my-medium.cnf /etc/my.cnf
初始化
./bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql/
--skip-name-resolve --defaults-file=/etc/my.cnf
启动
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
设置mysql开机自启动:
# cp /usr/local/src/mysql/support-files/mysql.server
/etc/rc.d/init.d/mysql
#chmod +x /etc/rc.d/init.d/mysql
#chkconfig --add mysql
测试并运行mysql
#/usr/local/mysql/bin/mysqld_safe --user=mysql &
#service mysql start
修改mysql管理员密码
#/usr/local/mysql/bin/mysqladmin -u root password password
还可以使用这个命令改密码
grant all privileges on *.* to root@'%' identified by
'malaguan' with grant option;
使用用户登录mysql
# /usr/local/mysql/bin/mysql -u root -p
输入mysql提示
-bash: mysql: command not found
原因:
是因为mysql命令的路径在/usr/local/mysql/bin下面,所以你直接使用
mysql命令时,系统在/usr/bin下面查此命令,所以找不到了。
解决办法:做个链接即可。
ln -s /usr/local/mysql/bin/mysql /usr/bin
进入mysql
show databases;
发现只有
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
而在5.5.*里面是
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
在5.5.*里面新增添了performance_schema功能