红联Linux门户
Linux帮助

一步一步教你 MySQL 数据库的快速配置

发布时间:2006-08-30 00:05:53来源:红联作者:厉烨
鼎鼎大名的数据库MySQL,最简单的安装过程如下:

1.下载:mysql-4.1.20.tar.gz(www.mysql.org)

2.//创建用户与组

[code][root@localhost root]#groupadd mysql
[root@localhost root]#useradd -g mysql mysql[/code]

3.//解压

[code][root@localhost root]#tar zxvf mysql-4.1.20.tar.gz[/code]

4.//安装

[code][root@localhost root]#cd mysql-4.1.20
[root@localhost mysql-4.1.20]# mkdir /opt/mysq
[root@localhost mysql-4.1.20]# ./configure --prefix=/opt/mysql
[root@localhost mysql-4.1.20]# make
[root@localhost mysql-4.1.20]# make install[/code]

5.//配置

[code][root@localhost mysql-4.1.20]# cd support-files/
[root@localhost support-files]# cp my-medium.cnf /etc/my.cnf
[root@localhost support-files]# cd /opt/mysql/bin
[root@localhost bin]# ./mysql_install_db --user=mysql
[root@localhost bin]# cd ..
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql var
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# cd bin
[root@localhost bin]# ./mysqladmin -u root password 123456[/code]

6.//启动与登陆

[code][root@localhost bin]# ./mysqld_safe --user=mysql &
[root@localhost bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.1.20-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
| test1 |
+----------+
3 rows in set (0.00 sec)

mysql> exit
Bye[/code]

7.//开机启动

方法是将"/opt/mysql/bin/mysqld_safe --user=mysql &"加入到"/etc/rc.local"文件中来实现随机启动.
文章评论

共有 0 条评论