ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MySQL源码安装

MySQL源码安装

原创 Linux操作系统 作者:adrain_001 时间:2012-03-28 17:10:31 0 删除 编辑
2010-08-23 20:40
Linux环境为CentOS release 4.7
Kernel 2.6.9-78.EL on an i686
login:
MySQL安装包mysql-4.1.18.tar.gz
[switch@localhost ~]$ su -
Password:
[root@localhost ~]# cd /data
[root@localhost data]# ll
总用量 16796
-rw-r--r-- 1 root root 17172994 12月 12 13:32 mysql-4.1.18.tar.gz
创建mysql用户组和用户
[root@localhost data]# groupadd mysql
[root@localhost data]# useradd -g mysql mysql
提取mysql源码文件
[root@localhost data]# tar -xzvf mysql-4.1.18.tar.gz
[root@localhost data]# ls
mysql-4.1.18 mysql-4.1.18.tar.gz
[root@localhost data]# cd mysql-4.1.18
创建和指定mysql安装目录
[root@localhost mysql-4.1.18]# mkdir /usr/local/mysql
[root@localhost mysql-4.1.18]# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_bin --with-extra-charsets=big5,ascii,gb2312,gbk,utf8,latin1
使用make编译程序
[root@localhost mysql-4.1.18]# make
[root@localhost mysql-4.1.18]# make install
复制mysql配置文件
[root@localhost mysql-4.1.18]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-4.1.18]# cd /usr/local/mysql/
创建mysq初始授权表
[root@localhost mysql]# bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password new-password
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password new-password
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the sql-bench directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
改变当前目录属性为root用户,-R为递归连子目录一起更改。
[root@localhost mysql]# chown -R root .
更改var目录属性
[root@localhost mysql]# chown -R mysql var
更改当前目录组为mysql用户
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# ll
总用量 40
drwxr-xr-x 2 root mysql 4096 12月 12 13:54 bin
drwxr-xr-x 3 root mysql 4096 12月 12 13:54 include
drwxr-xr-x 2 root mysql 4096 12月 12 13:54 info
drwxr-xr-x 3 root mysql 4096 12月 12 13:54 lib
drwxr-xr-x 2 root mysql 4096 12月 12 13:54 libexec
drwxr-xr-x 3 root mysql 4096 12月 12 13:54 man
drwxr-xr-x 7 root mysql 4096 12月 12 13:54 mysql-test
drwxr-xr-x 3 root mysql 4096 12月 12 13:54 share
drwxr-xr-x 5 root mysql 4096 12月 12 13:54 sql-bench
drwx------ 4 mysql mysql 4096 12月 12 13:57 var
后台启动mysql守护程序启动mysql数据库。
[root@localhost bin]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 31178
[root@localhost bin]# Starting mysqld daemon with databases from /usr/local/mysql/var
[root@localhost bin]# ps -A|grep mysql
31178 pts/1 00:00:00 mysqld_safe
31202 pts/1 00:00:00 mysqld
启动mysql
[root@localhost bin]# /usr/local/mysql/bin/mysql

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26690043/viewspace-719755/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-02-13

  • 博文量
    113
  • 访问量
    260310