Home > Database > Mysql Tutorial > Fedora 八下的MySQL源码安装手记

Fedora 八下的MySQL源码安装手记

WBOY
Release: 2016-06-07 16:24:40
Original
1153 people have browsed it

Fedora 8下的MySQL源码安装手记 源:http://blog.sina.com.cn/s/blog_48c95a190100e7eo.html 评: 系统开发计划改变!弃PostgreSQL!拥抱MySQL!当然前提是依然支持Berkeley DB作为存储引擎的MySQL版本,5.1.12版本的MySQL已经正式将BDB从数据库引擎列表中扫

Fedora 8下的MySQL源码安装手记
源:http://blog.sina.com.cn/s/blog_48c95a190100e7eo.html
评:
系统开发计划改变!弃PostgreSQL!拥抱MySQL!当然前提是依然支持Berkeley DB作为存储引擎的MySQL版本,5.1.12版本的MySQL已经正式将BDB从数据库引擎列表中扫地出门,虽然MySQL宣称这和Oracle收购Sleepycat没有任何关系,但是Oracle发面称是公司内部BDB开发团队要求取消支持的,所以也不太清楚哪一方在实话实说。后来大家又开始担心MySQL同样会抛弃InnoDB,因为财大气粗的Oracle同样收购了Innobase,虽然Oracle宣称依然会支持InnoDB,但MySQL在6.0中添加的神似InnoDB的猎鹰falcon却明显地表明了MySQL已经开始了它的未雨绸缪,毕竟还是怕Oracle釜底抽薪,所以狡兔三窟给自己留条后路是非常必要的了。好了,闲言少叙,言归正传。本人使用的MySQL版本为5.0.83,去MySQl官方网站上下载的时候一定要注意要下载source code版本,而不要下载二进制安装版本。现总结安装步骤如下:
1、解压mysql-5.0.83.tar.gz
tar -zxvf mysql-5.0.83.tar.gz
2、创建一个新的目录/usr/local/mysql以便作为MySQL的安装目录,然后进入到刚刚解压出来的mysql-5.0.83的目录下进行配置:安装到/usr/local/mysql下且语言使用gbk,关于其他参数可以查看相关文档。
./configure --prefix=/usr/local/mysql --with-charset=gbk
3、编译和安装
make
make install
4、创建用户和组
groupadd mysql
useradd -g mysql mysql
5、进入MySQL安装目录/usr/local/mysql,创建var目录并把./share/mysql/my-medium.cnf拷贝到mysql目录下并改名为my.cnf。
mkdir var
mv share/mysql/my-medium.cnf my.cnf
6、配置my.cnf,用编辑器打开my.cnf找到log-bin=mysql-bin这一行,将其注释掉
#log-bin=mysql-bin
7、安装数据库
bin/mysql_install_db  --user=mysql
8、设置目录权限属性
chown -R root .
chown -R mysql /usr/local/mysql/var
chgrp -R mysql .
9、启动MySQL
bin/mysql_safe --user=mysql &
10、进入数据库
bin/mysql
此时如果屏幕显示如下信息则进入数据库成功:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.83 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
11、简单操作测试
mysql> create database mydb ;
Query OK, 1 row affected (0.01 sec)
mysql> show databases ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mydb               |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.01 sec)
mysql> drop database mydb;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> create table mytable (
    -> id int,name varchar(20)
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql> insert into mytable values(5601083,'Zhichao Liang');
Query OK, 1 row affected (0.01 sec)

mysql> select * from mytable;
+---------+---------------+
| id      | name          |
+---------+---------------+
| 5601083 | Zhichao Liang |
+---------+---------------+
1 row in set (0.00 sec)

测试完毕,MySQL已经成功安装且可以运行!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template