RPM方式安装MySQL5.6.30
a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)
1 |
[[email protected] # |
2 |
mysql-libs-5.1.66-2.el6_3.x86_64 |
3 |
[[email protected] # |
b. 下载Linux对应的RPM包,如:CentOS6.6_64对应的RPM包,如下:
1 |
[[email protected] # |
2 |
total |
3 |
-rw-r--r--. |
4 |
-rw-r--r--. |
5 |
-rw-r--r--. |
c. 安装MySQL
1 |
[[email protected] # MySQL-server-5.6.30-1.linux_glibc2.5.x86_64.rpm |
2 |
[[email protected] # |
3 |
[[email protected] # |
4 |
#修改配置文件位置 |
5 |
[[email protected] # |
d. 初始化MySQL及设置密码
1 |
[[email protected] # |
2 |
[[email protected] # |
3 |
[[email protected] # |
4 |
# |
5 |
[[email protected] # |
6 |
mysql> ‘123456‘ ); #设置密码为123456 |
7 |
mysql> exit |
8 |
[[email protected] # |
e. 允许远程登陆
01 |
mysql> |
02 |
mysql> select host,user,password |
03 |
+-----------------------+------+-------------------------------------------+ |
04 |
| |
05 |
+-----------------------+------+-------------------------------------------+ |
06 |
| |
07 |
| |
08 |
| |
09 |
| |
10 |
+-----------------------+------+-------------------------------------------+ |
11 |
12 |
mysql> set password=password( ‘123456‘ ) ‘root‘ ; |
13 |
mysql> set host= ‘%‘ where ‘root‘ and ‘localhost‘ ; |
14 |
mysql> |
15 |
mysql> exit |
f. 设置开机自启动
1 |
[[email protected] # |
2 |
[[email protected] # |
3 |
mysql |
g. MySQL的默认安装位置
1 |
/var/lib/mysql/ #数据库目录 |
2 |
/usr/share/mysql #配置文件目录 |
3 |
/usr/bin #相关命令目录 |
4 |
/etc/init.d/mysql #启动脚本 |
修改字符集和数据存储路径
配置/etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码utf-8.
[html] view
plain copy
- [client]
- password = 123456
- port = 3306
- default-character-set=utf8
- [mysqld]
- port = 3306
- character_set_server=utf8
- character_set_client=utf8
- collation-server=utf8_general_ci
- #(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
- lower_case_table_names=1
- #(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
- max_connections=1000
- [mysql]
- default-character-set = utf8
时间: 2024-11-12 05:47:49