安装MySQL能够分为四步骤来进行。
第一步:下载MySQL.
从mysql网站上直接下载MySQL的源代码,并解压缩他。
现在mysql有好几个版本,我下载的是mysql-4.1.12.tar.gz档,并把他解压缩到了/usr/local/src里面。
假设下载的档案存放在当前的目录里,执行下面的指令解压缩:
#tar zxvf mysql-4.1.12.tar.gz -C /usr/local/src
这时候您的/usr/local/src/里面会多一个mysql-4.1.12的文档夹。
第二步:安装MySQL.
增加MySQL的系统账号:
#groupadd mysql
#useradd -g mysql mysql

进入/usr/local/src/mysql-4.1.12目录里面。
编译和安装MySQL
    cd /usr/local/src
tar -zxvf mysql-4.1.9.tar.gz
cd mysql-4.1.9
./configure \
--prefix=/usr/local/mysql \
--with-unix-sock-path=/tmp/mysql.sock \
--with-charset=utf8
make
make install
假如安装成功,接下来就是把MySQL的配置文档复制到/etc下面,执行如下指令:
#cp my-medium.cnf /etc/my.cnf




第三步:安装MySQL系统资 料库及配置安全属性

进入到mysql的安装目录里。
#cd /usr/local/mysql

安装系统资料库
bin/mysql_install_db --user=mysql

配置目录的安全性
chown -R root .
chown -R mysql var
chgrp -R mysql .
第四步:配置MySQL设定档
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!