ArchLinux

ArchLinux之LMAP攻略(2、源码安装mysql)

开始安装MySQL了。

先解压文件 

[root@fantlam fantlam]# tar -xzvf mysql-5.1.40.tar.gz

[root@fantlam mysql-5.1.40]# vi INSTALL-SOURCE

看看安装指南,发现有这么一段

我们可以参考它来做。

添加组mysql和用户mysql并加入其中

[root@fantlam mysql-5.1.40]# groupadd mysql
[root@fantlam mysql-5.1.40]# useradd -g mysql mysql
[root@fantlam mysql-5.1.40]# vi /etc/group
发现组里多了mysql


[root@fantlam mysql-5.1.40]# passwd mysql

输入新的 UNIX 口令:
重新输入新的 UNIX 口令:
passwd:已成功更新密码

接下来是编译三部曲了,熟悉linux源码安装的朋友都会熟知,一般的操作步骤如下:

[root@fantlam mysql-5.1.40]# ./configure --prefix=/usr/local/mysql
[root@fantlam mysql-5.1.40]# make
这过程需要等上几分钟
[root@fantlam mysql-5.1.40]# make install

完成后在user/local/已经有mysql目录的出现,继续按教程走。

[root@fantlam mysql-5.1.40]# cp support-files/my-medium.cnf /etc/my.cnf

[root@fantlam mysql-5.1.40]# cd /usr/local/mysql
[root@fantlam mysql]# ls -l
总计 20
drwxr-xr-x 2 root root 4096 11-17 10:36 bin
drwxr-xr-x 2 root root 4096 11-17 10:36 docs
drwxr-xr-x 3 root root 4096 11-17 10:36 include
drwxr-xr-x 3 root root 4096 11-17 10:36 lib
drwxr-xr-x 3 root root 4096 11-17 10:36 share

[root@fantlam mysql]# chown -R mysql:mysql .
[root@fantlam mysql]# ls -l
总计 20
drwxr-xr-x 2 mysql mysql 4096 11-17 10:36 bin
drwxr-xr-x 2 mysql mysql 4096 11-17 10:36 docs
drwxr-xr-x 3 mysql mysql 4096 11-17 10:36 include
drwxr-xr-x 3 mysql mysql 4096 11-17 10:36 lib
drwxr-xr-x 3 mysql mysql 4096 11-17 10:36 share

可以看下前后的不同。

[root@fantlam mysql]# bin/mysql_install_db --user=mysql(初始化数据库)
Installing MySQL system tables...
OK
Filling help tables...
OK

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 fantlam password 'new-password'

Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

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 mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

顺利完成。
[root@fantlam mysql]# chown -R root .
[root@fantlam mysql]# chown -R mysql var

启动mysql

[root@fantlam mysql]# bin/mysqld_safe --user=mysql &(&表示抛到后台执行)
[1] 30793
[root@fantlam mysql]# 091117 12:17:55 mysqld_safe Logging to '/usr/local/mysql/var/fantlam.err'.
091117 12:17:55 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

安装完成,可以试下连接验证一下。

(0)

本文由 Linux视野 作者:fantlam 发表,转载请注明来源!

关键词:, , , ,

热评文章

评论:

0 条评论,访客:0 条,博主:0 条
  1. 网络编程
    网络编程发布于: 

    收藏了,方便以后查找。我的博客也是关于watir方面的,www.sdgz.cn

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注