fedora9上安装mysql5.0

幻影的博客:http://chen.wenz.blog.163.com/

1、下载源码包

http://dev.mysql.com/downloads/mysql/6.0.html 里下载到 mysql-6.0.0-alpha.tar.gz

2、创建mysql的用户组和用   户

groupadd mysql
useradd -g mysql mysql

3、编译安装 mysql

cp mysql-6.0.0-alpha.tar.gz /usr/local/src
tar -zxvf mysql-6.0.0-alpha.tar.gz
cd mysql-6.0.0-alpha
./configure --prefix=/usr/local/mysql #指定安装目录
make
make install

4、配置并启动mysql

cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db --user=mysql #初始化安装mysql数据库
chown -R root .
chown -R mysql var
bin/mysqld_safe --user=mysql &

5、更改mysql的root密码

/usr/local/mysql/bin/mysqladmin -u root password [新密码]

6、设置mysql开机自启动

cp support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mycql
chkconfig --add mysql
service mysql start


Starting MySQL.Manager of pid-file quit without updating fi[失败]

罪魁祸首——selinux
打开/etc/selinux/config把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器后问题就得以解决。

 

 

 

 

 

 


=============================================
修改MySQL默认数据库的编码
需要编辑my.cnf文件:
vi /etc/my.cnf
在[mysqld] 下添加以下2项:
default-character-set=utf8
init_connect='SET NAMES utf8'
在[client] 下添加以下1项:
init_connect='SET NAMES utf8'
  (注:如果没[client]项时,可以自己手动添加进去)
保存后重启mysql,再运行以下命令:
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
可以看到,修改已经生效了,
接下来是建库测试,中文没再乱码了
===============================================
关闭Mysql:service mysql stop

你可能感兴趣的:(html,mysql,Blog)