Home > Database > Mysql Tutorial > body text

Linux下MySQL的安装和配置_MySQL

WBOY
Release: 2016-06-01 13:51:18
Original
1022 people have browsed it

1.安装文件

MySQL-devel-5.0.22-0.i386.rpm

MySQL-shared-5.0.22-0.i386.rpm

MySQL-server-5.0.22-0.i386.rpm

MySQL-client-5.0.22-0.i386.rpm

2.安装

按照上面的顺序安装

rpm -ivh MySQL-devel-5.0.22-0.i386.rpm

rpm -ivh MySQL-shared-5.0.22-0.i386.rpm

rpm -ivh MySQL-server-5.0.22-0.i386.rpm

rpm -ivh MySQL-client-5.0.22-0.i386.rpm

3.修改密码

格式:mysqladmin -u用户名 -p旧密码 password 新密码

/usr/bin/mysqladmin -u root password 123456

4.启动和停止

service mysql start

service msyql stop

service mysql restart

5.配置

如果/etc/目录下没有my.cnf配置文件,请到/usr/share/mysql/下找到*.cnf文件,拷贝其中一个到/etc/并改名为my.cnf)中。命令如下:cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

#注掉此行socket= /var/lib/mysql/mysql.sock

统一编码:

在[mysql]下加入:default-character-set=utf8

在[mysqld]下加入:default-character-set=utf8

6.更改数据库位置

在/etc/rc.d/init.d/mysql文件中修改datadir的值,因基本不需修改,暂不做研究

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!