MySQL 完整安装配置

发布时间:2020-08-17 20:06:56 作者:mckobe23
来源:ITPUB博客 阅读:118

一.创建用户和路径
1. 创建 MySQL 用户组和用户

# groupadd mysql
#
useradd -g mysql mysql

2.创建数据存储路径
#
mkdir /data/dbfile
#
chown -R mysql.mysql /data/dbfile


二.安装 mysql 5.x.x.tar.gz
1.编译
默认字符集
扩展字符集
安装Innodb
指定数据存储路径
指定系统配置文件路径

# ./configure --prefix=/data/mysql5 --with-charset=utf8 --with-extra-charsets=all --with-plugins=partition,heap,innobase,myisam --enable-thread-safe-client --without-docs --with-pthread --enable-static --with-big-tables --without-debug --localstatedir=/data/dbfile --sysconfdir=/etc ----infodir=/data/mysql5

# make
#
make install


2.拷贝 my.cnf
#
cp mysql-5.1.31/support-files/my-medium.cnf /etc/my.cnf


3.初始化数据库
#
mysql5131/bin/mysql_install_db --user=mysql


4.启动 MySQL 服务
#
mysql5/bin/mysqld_safe --user=mysql &


5.停止 MySQL 服务
#
mysql5/bin/mysqladmin shutdown


6.MySQL 调优 my.cnf

包含Innodb配置


7.删除旧 Innodb 日志文件

# rm /data/dbfile/ibdata1 ib_logfile0 ib_logfile1


8.重启 MySQL


9.查看 Innodb 运行状态
mysql >
show variables like '%innodb%';

+---------------------------------+------------------------+
| Variable_name | Value |
+---------------------------------+------------------------+
| have_innodb | YES |
+---------------------------------+------------------------+


三.创建数据库
mysql >
GREATE DATABASE aa;

【查看 aa 默认字符集】

mysql > show table status from test like '%aa%'G;

*************************** 1. row ***************************
Name: aa
Engine: InnoDB
Version: 10
Row_format: Fixed
Rows: 8
Avg_row_length: 7
Data_length: 56
Max_data_length: 1970324836974591
Index_length: 1024
Data_free: 0
Auto_increment: NULL
Create_time: 2009-04-13 10:28:14
Update_time: 2009-04-13 11:51:37
Check_time: NULL
Collation: gbk_chinese_ci
Checksum: NULL
Create_options:
Comment:


四.设置 MySQL 服务开机自启动
通过
service mysql start | stop | restart 管理 mysql 服务

# cp support-files/mysql.server /etc/rc.d/init.d/mysqld 设置使mysql每次启动都能自动运行

# chkconfig --add mysqld

# chkconfig --level 345 mysqld on

# service mysqld start //启动mysqld服务


五.设置全局登录

通过 # mysql 直接登录

export PATH=$PATH:/data/mysql5/bin

[@more@]
推荐阅读:
  1. Windows10系统mysql 8.0.12解压版是怎么样安装配置的
  2. 使用Java怎么连接Mysql 8.0.18

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

安装配

上一篇:查找和杀掉postgresql堵塞的会话

下一篇:ICCV2019入选论文分析 谷歌实力霸榜!国内中科院第一,产业界商汤领跑

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》