日期:2014-05-16  浏览次数:20735 次

Ubuntu 10.4 离线安装Mysql

英文原版安装过程可以看这里:http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html 我在最后也贴出来了,可以拖到最下面查看。

下面的步骤是我翻译过来并进行了一定的调整

       1. groupadd mysql

  2. mkdir /home/mysql

  3. useradd -g mysql -d /home/mysql mysql

  4. copy mysql-5.0.45-linux-i686-icc-glibc23.tar.gz到/usr/local目录

  5. 解压:tar zxvf mysql-5.0.45-linux-i686-icc-glibc23.tar.gz

  6. ln -s mysql-5.0.45-linux-i686-icc-glibc23 mysql

  7. cd /usr/local/mysql

  8. chown -R mysql .

  9. chgrp -R mysql .

  10. scripts/mysql_install_db --user=mysql (一定要在mysql目录下执行,注意输出的文字,里边有修改root密码和启动mysql的命令)

  11. 为root设置密码: ./bin/mysqladmin -u root password 'passw0rd'

配置和管理msyql:

  1. 修改mysql最大连接数:cp support-files/my-medium.cnf ./my.cnf,vim my.cnf,增加或修改max_connections=1024

  关于my.cnf:mysql按照下列顺序搜索my.cnf:/etc,mysql安装目录,安装目录下的data。/etc下的是全局设置。

  2. 启动mysql:/usr/local/mysql/bin/mysqld_safe --user=mysql &

  3. 停止mysql:mysqladmin -uroot -ppassw0rd shutdown 注意,u,p后没有空格

  4. 设置mysql自启动:把启动命令加入/etc/rc.local文件中

  5. 允许root远程登陆:

  1)本机登陆mysql:mysql -u root -p (-p一定要有);改变数据库:use mysql;

  2)从所有主机:grant all privileges on *.* to root@"%" identified by "passw0rd" with grant option;

  3)从指定主机:grant all privileges on *.* to root@"192.168.11.205" identified by "passw0rd" with grant option; flush privileges;

  4) 进mysql库查看host为%的数据是否添加:use mysql; select * from user;

  6. 创建数据库,创建user:

  1) 建库:create database test1;

  2) 建用户,赋权:grant all privileges on test1.* to user_test@"%" identified by "passw0rd" with grant option;

  3)删除数据库:drop database test1;


2.2. Installing MySQL from Generic Binaries on Unix/Linux

Oracle provides a set of binary distributions of MySQL. These include binary distributions in the form of compressed tar files (files with a .tar.gz extension) for a number of platforms, as well as binaries in platform-specific package formats for selected platforms.

This section covers the installation of MySQL from a compressed tar file binary distribution. For other platform-specific package formats, see the other platform-specific sections. For example, for Windows distributions, see Section 2.3, “Installing MySQL on Microsoft Windows”.

To obtain MySQL, see Section 2.1.3, “How to Get MySQL”.

MySQL compressed tar file binary distributions have names of the form mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, 5.5.29), and OS indicates the type of operating system for which the distribution is intended (for example, pc-linux-i686 or winx64).

To install MySQL from a compressed tar file binary distribution, your system must have GNU gunzip to uncompress the distribution and a reasonable tar to unpack it. If your tar program supports the z option, it can both uncompress and unpack the file.

GNU tar is known to work. The standard tar