安装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
|