2008年(91)
分类: Mysql/postgreSQL
2008-03-28 00:07:28
在各大网站都可以下载。
Shell>groupadd mysql
shell> useradd -g mysql mysq
cd mysql-
liangyin@debian:~/mysql-
然后用./configure –-prefix=/usr/local/mysql
最后make;make install
其实make;之后可以用: echo $? 返回上一步的情况,如果出现0.则说明上一步是正确的,否则说明上一步有错。
Echo $?可以用来验证每一个上一步的命令是否正确。
cp ./support-files/my-medium.cnf /etc/my.cnf
ls -al /etc/my.cnf
-rw-r--r-- 1 root root 4912 2008-03-27 17:29 /etc/my.cnf
debian:/usr/local/mysql# chown -R mysql ./
debian:/usr/local/mysql# chgrp -R mysql ./
debian:/usr/local/mysql# ls -al
total 2
drwxr-sr-x 11 mysql mysql 280 2008-03-27 23:51 .
drwxrwsr-x 16 root staff 424 2008-03-27 23:30 ..
drwxr-sr-x 2 mysql mysql 1552 2008-03-27 23:51 bin
drwxr-sr-x 3 mysql mysql 72 2008-03-27 00:43 include
drwxr-xr-x 2 mysql mysql 80 2008-03-27 23:51 info
drwxr-sr-x 3 mysql mysql 72 2008-03-27 00:43 lib
drwxr-sr-x 2 mysql mysql 104 2008-03-27 23:51 libexec
drwxr-sr-x 3 mysql mysql 72 2008-03-27 23:51 man
drwxr-sr-x 7 mysql mysql 456 2008-03-27 23:51 mysql-test
drwxr-sr-x 3 mysql mysql 72 2008-03-27 23:51 share
drwxr-sr-x 5 mysql mysql 888 2008-03-27 23:51 sql-bench
这样保证:/usr/local/mysql下的文件都属于用户root,所属的组为mysql。
但是有个要例外:就是文件/var。他是属于用户mysql的,所属的组也是。
/home/liangyin/mysql-
Installing MySQL system tables...
OK
Filling help tables...
OK
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h debian 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 mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
再次更改权限:/usr/local/mysql/目录下:
shell> chown -R root .
shell> chown -R mysql var
这样做目的:
Most of the MySQL installation can be owned by `root' if you like.
The exception is that the data directory must be owned by `mysql'.
To accomplish this, run the following commands as `root' in the
installation directory:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
#在mysql的bin目录下以用户mysql启动他。
然后可以看到3306.
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
#my.cnf这个是mysql的配置文件
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
#先改/usr/local/mysql下面的文件的权限,让用户和组属于mysql。
shell> bin/mysql_install_db --user=mysql
#以用户mysql的身份开启
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &