linux下mysql安装和调优
1.yum
yum -y install mysql-server mysql
2.RPM安装
http://dev.mysql.com/downloads/ 下载RPM包,请确认服务器版本,我的是红帽5.9,下载的是下面的版本,bundle是集合包
MySQL-5.6.21-1.rhel5.x86_64.rpm-bundle.tar
[root@localhost ~]# cd /soft/
[root@localhost soft]# ll
总计
-rwxr--r-- root root - : MySQL-5.6.-.rhel5.x86_64.rpm-bundle.tar
-rw-r--r-- wheel - : MySQL-client-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-devel-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-embedded-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-server-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-shared-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-test-5.6.-.rhel5.x86_64.rpm
rpm -Uvh MySQL-*.rpm
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('root');
Query OK, rows affected (0.07 sec)
3.mysql的基本命令和字段类型信息
show databses;
use mysql;
show tables;
describe user;
create database cms;
select database();

DATETIME(占8字节)
TIMESTAMP(占4字节)
DATE(占4字节)
YEAR(占1字节)
TIME(占3字节)
mysql> create table user1 select * from te where username='xx';
mysql> create table user2 select * from te where false
mysql> alter table te rename to user;
mysql> alter table file change guid gid int(10) not null;
mysql> load data infile '/etc/passwd' into table file fields terminated by ":" lines terminated by "\n";
mysql> alter table file drop column id;
mysql> alter table file add id int(10) unsigned not null auto_increment primary key(id) first;
mysql> select * from file into outfile "/soft/user.txt" fields terminated by "\t" lines terminated by "\n";
service mysql start --skip-grant-table&update mysql.user set password=password("123") where user='root'
mysqladmin -uroot -p password "1234"
GRANT all ON db.* TO dbuser@'%' IDENTIFIED BY 'password'
REVOKE all ON db.* FROM dbuser@'%'
flush privileges;
MySQL日志类型
1.错误日志:记录数据库服务启动,运行过程中产生的错误信息 默认开启
2.查询日志:记录登录用户执行的sql语句 默认不开启 /etc/my.cnf
general-log
3.慢查询日志:超时查询sql 默认不开启,默认超时10s
slow-query-log
slow-query-log-file=iflytek-slow-query.log
long-query-time=5
4.binlog日志:使数据发生改变的sql语句 默认不开启
打开/etc/my.cnf
log-bin=mysql-bin【默认名称可以不写】
mysqlbinlog -start-position=4 -stop-position=200 bin-log.000001 | mysql -uroot -proot
show binlog events
flush logs;
purge master logs to "iflytek-bin.000002" 删除002之前的binlog
reset master 重新设置binlog日志
【etc/my.cnf】
log-bin=/mysqldata/iflytek-bin
chown mysql /mysqldata/
linux下mysql安装和调优的更多相关文章
- linux下MySQL安装登录及操作
linux下MySQL安装登录及操作 二.安装Mysql 1.下载MySQL的安装文件 安装MySQL需要下面两个文件: MySQL-server-4.0.16-0.i386.rpm MySQL-cl ...
- Linux下MySQL安装和配置
--Linux下MySQL安装和配置 ---------------------------2014/05/18 Linux下MySQL的配置和安装 本文的安装采用 rpm 包安装 1.首先在官网下载 ...
- Linux下Mysql安装(RPM安装)
1. 首先检查机器里是否已经存在MySQL $ rpm -qa | grep mysql 2. 去官网下载相应的rpm包:https://dev.mysql.com/downloads/mysql/ ...
- Linux下MySQL安装及配置
Linux下MySQL安装及配置 安装MySQL Ubuntu系统中,直接使用apt install的方式去安装MySQL的服务端和客户端,MySQL的客户端必须安装,否则无法通过命令连接并操作MyS ...
- linux 下 mysql安装和配置
最近在学习R语言,看到R与数据库交互这一部分,就自己动手实践了一下,数据库选择的是mysql,主要记录下linux下怎么安装mysql. 网上的很多资料都有相关的文章,这里只是记录下自己安装过程中遇到 ...
- Linux下mysql安装过程
到mysql官网下载mysql编译好的二进制安装包,在下载页面Select Platform:选项选择linux-generic,然后把页面拉到底部,64位系统下载Linux - Generic (g ...
- Linux下Mysql安装教程详解
Linux下软件安装一般有三种方式:RPM包方式(通过Redhat 第三方包管理系统).二进制包和源码包.本篇主要介绍二进制包安装mysql数据库的方式. 如何获取二进制源码包 当然是到mysql官网 ...
- Linux下mysql安装记录
1.MySQL下载路径:https://dev.mysql.com/downloads/ Linux下的安装步骤:http://www.runoob.com/linux/mysql-install-s ...
- linux下MySQL安装及设置
转自:http://www.entage.net/1/viewspace-25420 1. 关于本文 本文将以MySQL 5.0.51为例,以CentOS 5为平台,讲述MySQL数据库的安装和 ...
随机推荐
- 实用的IP地址处理模块IPy
https://www.cnblogs.com/cherishry/p/5916935.html IPy安装 pip install IPy IP地址.网段的基本处理 IPy模块包含IP类,使用它可以 ...
- asm335x系列adc和触摸屏驱动(转)
An analog-to-digital converter (abbreviated ADC) is a device that uses sampling to convert a continu ...
- 解决移动端H5海报滑动插件适应大部分手机问题 手机端高度自适应
Html5微信端滑屏海报在各种尺寸的手机上总会有这样那样的问题,经过多次制作总结出来一些小心得,分享下. 我使用的是jquery插件swiper.min.js,动画可以利用animate.css,如果 ...
- 用Linq对String类型的数字求和
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- (转)ASP连接sql server实例解析
本文转载自:http://blog.csdn.net/xys_777/article/details/5696276 1.首先确定自己的iis没有问题 2.其次确定自己sqlserver没有问题 然后 ...
- find 和 find_all 用法
soup = BeautifulSoup(requests.get(url).text, 'html.parser') soup.find('span', class_='item_hot_topic ...
- 最小化安装CentOS7,没有ifconfig命令---yum search command_name搜索未知包名
新安装的CentOS7系统,想查询ip的时候,发现没有ifconfig这个命令: -bash: ifconfig: 未找到命令 yum安装: 没有可用软件包 ifconfig 既然知道命令,搜索一下命 ...
- Ubantu 网卡绑定固定IP
# The primary network interface auto eth0 #iface eth0 inet dhcp iface eth0 inet static address 192.1 ...
- 用shp制作geoJson格式地图数据(shp convert to geoJson)
本文紧接前文,简单说明利用shp数据制作Echarts支持的geoJson格式的地图数据.本文以北京市通州区各镇的shp数据为例进行说明. 软件环境: ArcGIS 10.2 (ArcGIS 10.2 ...
- setAttribute第三个参数
object.setAttribute(sName, vValue [, iFlags]) sName参数应是Dom属性而非html中的属性.Dom中Html专有的接口属性应该以小写字母开头,如果属性 ...