首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

装配mysql-5.0

2012-07-22 
安装mysql-5.0Linux (non RPM packages) downloads (platform notes)Linux (x86)??? ??? 5.1.40??? 120.8M

安装mysql-5.0

Linux (non RPM packages) downloads (platform notes)
Linux (x86)??? ??? 5.1.40??? 120.8M??? Download | Pick a mirror

click "Pick a mirror" and select your closest mirror from the lists below by your sources.list
check the size whether matches the size in the list
otherwise mistakes will occur while installing...

mysql-5.1.40-linux-i686-glibc23(2).tar.gz改名为mysql-5.1.40-linux-i686.tar.gz,便于解压



==========================================================================================================================
hi I am system admin in turkey and same problems had happenned on my system.
If you use mysql-5.0, you can setup it without any problem. I aggre with you that there is a problem in their mysql-5.1.40 setup-script.
==========================================================================================================================

下载mysql-5.0
http://dev.mysql.com/downloads/
MySQL 5.0 — Previous GA release=>Linux (non RPM, Intel C/C++ compiled, glibc-2.3)=>
Linux (x86)??? ??? 5.0.88??? 110.5M??? Download | Pick a mirror=>Pick a mirror

click "Pick a mirror" and select your closest mirror from the lists below by your sources.list
check the size whether matches the size in the list
otherwise mistakes will occur while installing...

mysql-5.0.88-linux-i686-icc-glibc23.tar.gz在/home/tongxiaoming520/applications/中



安装笔记:

1.首先添加mysql用户组
tongxiaoming520@tongxiaoming520-laptop:~$ groupadd mysql

2.添加mysql用户,并指定到mysql用户组
tongxiaoming520@tongxiaoming520-laptop:~$ useradd -g mysql mysql

3.解压缩mysql-5.0.88-linux-i686-icc-glibc23.tar.gz到安装目录(/usr/local/)
tongxiaoming520@tongxiaoming520-laptop:~$ cd /usr/local
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ sudo tar zxvf /home/tongxiaoming520/applications/mysql-5.0.88-linux-i686-icc-glibc23.tar.gz
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ ls

4.创建mysql软连接mysql-VERSION-OS
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ sudo ln -s /usr/local/mysql-5.0.88-linux-i686-icc-glibc23 mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ cd mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ ls

5.设定mysql安装目录权限,设置owner为mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R mysql .
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chgrp -R mysql .

6.执行mysql系统数据库初始化脚本
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo scripts/mysql_install_db --user=mysql

7.设定data目录权限,分配给mysql用户,为了mysql程序能读写data目录下的文件
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R root .
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R mysql data?


8.使用mysql帐号启动mysql应用
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo bin/mysqld_safe --user=mysql &?

9.设置root密码
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo bin/mysqladmin -u root password '123123'?


10.登录mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ bin/mysql -u root -p?
Enter password:??
登录成功会看到:
1. Welcome to the MySQL monitor.? Commands end with ; or \g.?
2. Your MySQL connection id is 229?
3. Server version: 5.1.40-log MySQL Community Server (GPL)?
4.??
5. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.?
6.??
7. mysql>??

这时mysql已经装好了,可以查看数据库了,但在正式使用数据库开发与部署的时候还需要做一些工作:


1.设定配置文件my.cnf

??? 按照需求copy my-***.cnf到/etc/my.cnf

2.修改默认字符集utf8

??? (1).[client]下加入default-character-set=utf8
??? (2).[mysqld]下加入default-character-set=utf8

3.设置默认存储引擎
???? mysql for linux的版本默认使用的数据库引擎是MyISAM,但只有InnoDB引擎支持事务,
所以需要修改配置:

??? (1).[mysqld]下加入default-storage-engine=INNODB

4.配置innodb参数
?

??? (1).找到# Uncomment the following if you are using InnoDB tables
??????? 去掉innodb_*下的所有#

??? (2).如果安装mysql的目录不是默认的,则需要修改
??????? # mysql 默认安装目录为 /usr/local/mysql/
??????? # mysql 默认表空间目录安装目录为 /usr/local/mysql/data/

??????? innodb_data_home_dir=/usr/local/database/mysql/data/
??????? innodb_log_group_home_dir=/usr/local/database/mysql/data/

5.设置系统服务

??? 让linux启动的时候就启动mysql服务
Shell代码

?? 1. shell> cd /usr/local/mysql/?
?? 2. shell> cp support-files/mysql.server /etc/init.d/mysql?
?? 3. shell> chmod 777 /etc/init.d/mysql??
?? 4. shell> chkconfig --add mysql?
?? 5. shell> chkconfig --level 35 mysql on?







每次手动启动mysql服务
tongxiaoming520@tongxiaoming520-laptop:~$ cd /usr/local/mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R mysql data
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo bin/mysqld_safe --user=mysql &
[1] 6468
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ nohup: 忽略输入重定向错误到标准输出端
Starting mysqld daemon with databases from /usr/local/mysql-5.0.88-linux-i686-icc-glibc23/data


tongxiaoming520@tongxiaoming520-laptop:~$ ps -A | grep mysql
?6468 pts/0??? 00:00:00 mysqld_safe
?6491 pts/0??? 00:00:00 mysqld
tongxiaoming520@tongxiaoming520-laptop:~$ cd /usr/local/mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ bin/mysql -u root
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.88 MySQL Community Server (GPL)

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

mysql>











tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo scripts/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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h tongxiaoming520-laptop password 'new-password'

Alternatively you can run:
./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 . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./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 http://shop.mysql.com

热点排行