centos 6.0安装MySQL mysql-5.1.59全过程

 1、到mysql下载mysql
下载地址: http://www.mysql.com/downloads/
2、上传到CentOS
本例放在 /home/cui 目录中
3、创建mysql组及用户
groupadd mysql
[root@centos1 ~]# useradd -g mysql mysql
4、编辑文件权限
[root@centos1 cui]# chmod 755 mysql-5.1.59.tar.gz
5、centosmysql编译和安装
  解压:
[root@centos1 cui]# tar zxvf mysql-5.1.59.tar.gz
 进入到mysql安装包
[root@centos1 cui]# cd mysql-5.1.59
  配置参数
[root@centos1 mysql-5.1.59]#  ./configure --prefix=/usr/local/mysql --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --with-named-curses-libs=/usr/lib/libncursesw.so.5
预编译
[root@centos1 mysql-5.1.59]#   make
安装 很多代码 耐心等待
[root@centos1 mysql-5.1.59]#   make install
很多代码耐心等待
6、配制centos mysql安装只是第一步,我们还要对centosmysql进行相应的配制
一般的情况下centosmysql要找配制文件my.cnf,位置在/etc目录下,所以我们得把文件my.cnf文件放到/etc/目录下。
让centosmysql服务器启动时能找到它。我们安装好centosmysql后,配制文件应该在/usr/local/mysql/share/mysql目录中,配制文件有几个,比如my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf,不同的流量的网站和不同配制的服务器环境,当然需要有不同的配制文件了。
一般的情况下,my-medium.cnf这个配制文件就能满足我们的大多需要;
进入/usr/local/mysql这个目录,
看一下是不是已经安装好了呢??
[root@centos1 ~]#  cd /usr/local/mysql/
[root@centos1 mysql]#   ls
bin include info lib libexec man mysql-test share sql-bench
我们把/usr/local/mysql/share/mysql这个目录下的my-medium.cnf,复制为my.cnf到/etc目录下。
[root@centos1 ~]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
做了这些工作以后,还得创造centosmysql授权表, 否则数据库也是启动不了。mysql_install_db,这个命令的用途就是做这个的。
centosmysql安装的命令都安装到了/usr/local/mysql/bin这个目录中。
[root@centosmysql]#/usr/local/mysql/bin/mysql_install_db
运行mysql_install_db命令过后,我们查看/usr/local/mysql就会发现,有个var的目录。
这个目录,就是用来装所有数据库的位置,比如我们创建了linuxsir的数据库后,
就在在//usr/local/mysql/mysql/var目录中有linuxsir的目录。这回应该明白了吧。
7、启动centosmysql服务器,可能这是最轻松的了,不过也不能高兴的太早,因为有时会出现权限方面的错误。
centosmysql服务器启动,应该是/usr/local/mysql/share/mysql目录中的 mysql.server
启动方法是:
[root@centos1 ~]#  /usr/local/mysql/share/mysql.server start
如果不能启动请运行/usr/local/mysql/bin/mysqld_safe --user=root 就能够启动了!!
接着输入/usr/local/mysql/share/mysql/mysql.server start即可成功启动


好了,我们把密码设置为123456 /usr/local/mysql/bin/mysqladmin -u root password 123456


如果没有返回错误说明正确了。

接着输入/usr/local/mysql/bin/mysql -u root -p就可以管理centos mysql安装了。

 

 

MySQL Server 5.1 This is a release of MySQL, a dual-license SQL database server. For the avoidance of doubt, this particular copy of the software is released under the version 2 of the GNU General Public License. MySQL is brought to you by Oracle. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. License information can be found in the COPYING file. MySQL FOSS License Exception We want free and open source software applications under certain licenses to be able to use specified GPL-licensed MySQL client libraries despite the fact that not all such FOSS licenses are compatible with version 2 of the GNU General Public License. Therefore there are special exceptions to the terms and conditions of the GPLv2 as applied to these client libraries, which are identified and described in more detail in the FOSS License Exception at <http://www.mysql.com/about/legal/licensing/foss-exception.html>. This distribution may include materials developed by third parties. For license and attribution notices for these materials, please refer to the documentation that accompanies this distribution (see the "Licenses for Third-Party Components" appendix) or view the online documentation at <http://dev.mysql.com/doc/>. GPLv2 Disclaimer For the avoidance of doubt, except that if any license choice other than GPL or LGPL is available it will apply instead, Oracle elects to use only the General Public License version 2 (GPLv2) at this time for any software where a choice of GPL license versions is made available with the language indicating that GPLv2 or any later version may be used, or where a choice of which version of the GPL is applied is otherwise unspecified. For further information about MySQL or additional documentation, see: - The latest information about MySQL: http://www.mysql.com - The current MySQL documentation: http://dev.mysql.com/doc Some Reference Manual sections of special interest: - If you are migrating from an older version of MySQL, please read the "Upgrading from..." section. - To see what MySQL can do, take a look at the features section. - For installation instructions, see the Installing and Upgrading chapter. - For the new features/bugfix history, see the MySQL Change History appendix. You can browse the MySQL Reference Manual online or download it in any of several formats at the URL given earlier in this file. Source distributions include a local copy of the manual in the Docs directory.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值