Mac mysql sql_model引起的问题
问题:
我这里时应为timestamp引起的,服务器的数据使用的mysql5。本地使用的是mysql8,sql_model 不同导致数据不能够在数据库中添加。
解决:
在/etc/下查找my.cnf文件,如果有就使用,没有新建一个my.cnf文件,
然后开始编辑,sudo vi /etc/my.cnf
具体内容如下,网上找的。然后就是问题关键所在了。sql_model的配置
需要在
[mysqld] sql_mode=''
我这里图省事,就写了空。可以找几个网站,去查看每个选项的作用
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
default-character-set=utf8
#password = your_password
port =
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
character-set-server=utf8
init_connect='SET NAMES utf8
port =
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache =
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server=utf8
init_connect='SET NAMES utf8'
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking # Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin # binary logging format - mixed recommended
binlog_format=mixed # required unique id between and ^ -
# defaults to if master-host is not set
# but will not function as a master if omitted
server-id = # Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# ) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# ) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between and ^ -
# (and different from the master)
# defaults to if master-host is set
# but will not function as a slave if omitted
#server-id =
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin # Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to - %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit =
#innodb_lock_wait_timeout = [mysqldump]
quick
max_allowed_packet = 16M [mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=utf8 [myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M [mysqlhotcopy]
interactive-timeout
下一步可能需要权限
sudo chmod 664 /etc/my。cnf https://blog.csdn.net/wyzxg/article/details/8787878 参数可以看下
Mac mysql sql_model引起的问题的更多相关文章
- Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的解决办法
我的环境:Mac 10.11.6 ,mysql 5.7.14 . mac mySql 报错ERROR 2002 (HY000): Can't connect to local MySQL serv ...
- Mac mysql 解决中文乱码
Mac mysql 解决中文乱码问题 出现"???"之类的无法识别的乱码 到/etc目录下自己建一个my.cnf文件(需要最高权限,使用sudo su),然后写入内容: [clie ...
- Mac - MySQL初始密码忘记重置MySQL root密码
在什么情况下,需要重置root密码呢?那就是我们忘记了.还有一种比较坑的,那就是笔者的这种情况.按照正常的情况下,MySQL安装完之后,会弹出一个对话框,显示着一个临时的root密码,但无论笔者如何重 ...
- mac mysql 编码配置
mac mysql 编码配置 (mysql目录下没有my.cnf) 想要修改编码发现自己的/usr/local/mysql/support-files里面根本没有my.cnf 安装方式是去mysql官 ...
- Mac Mysql [ERR] 2006 - MySQL server has gone away
Mac mysql 安装后,导入sql数据,出现这个错误: 处理方式,是因为sql文件太大,需要修改mysql的配置.如果没有my.cnf就自己建一个. cd /etc sudo vim my.cnf ...
- mac mysql 使用注意事项
mac mysql 使用注意事项 .安装 直接通过下载官网上的dmg安装包进行安装,mysql--osx10.-x86_64(我的安装文件) ,安装完成后在系统偏好设置里面有mysql选项,我们可以通 ...
- Mac Mysql 5.6.4修改初始化密码
Mac Mysql 修改初始化密码 第一步: 点击系统偏好设置->最下边点MySQL,在弹出页面中,关闭服务 第二步:进入终端输入:cd /usr/local/mysql/bin/回车后 登 ...
- mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径
首先去官网下载: http://www.mysql.com/downloads/ 我下载了5.6.11的dmg然后安装,安装完成之后..如果要用终端去玩SQL.那么一开始要输入很长的:/usr/loc ...
- Mac Mysql初始密码重置
今天晚上mac更新后重装MySQL 安装完成后 启动服务,死活登录不了 提示1045错误.按照网上的资料对MySQL密码进行重置.记录步骤如下: 1.首先关闭MySQL服务 系统偏好设置->最下 ...
随机推荐
- 使用Flex4画图形:圆、矩形、线
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...
- Oracle创建表及管理表
转自:https://www.linuxidc.com/Linux/2018-05/152566.htm 1. Oracle表的创建及管理 创建表包括三个要素,表名,列名,数据类型.每个表都有对应 ...
- sql 日期格式
select CONVERT(varchar(10), getDate(),121) --不要时间2002-01-01 select CONVERT(varchar(10), getDate(),12 ...
- visio交叉线不凸起
使用visio作图时,经常会遇到交叉线在相交时会形成一个弯曲弓形,这有时十分影响视图效果.可以采用下面的方法消除弓形. 1.visio2003:只需要选中该交叉线,选择“格式”->“行为”,在打 ...
- VSFTP 服务器配置
解决root用户无法登陆ftp传输文件的问题 配置vsftpd用户,启用root用户. #cd /etc/vsftpd #vi ftpusers 注释掉root 修改user_list文件 # ...
- centos7 自动定时备份mysql数据库
shell脚本:mysqlbak.sh #!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinexpo ...
- Redis入门高级部分
Redis: redis批量删除 redis数据备份和恢复 redis安全 redis性能测试 Redis 客户端连接 redis管道技术 redis分区 java操作redis redis批量删除 ...
- Crash 文件调试
Xcode目录下执行 find . -name symbolicatecrash 找到symbolicatecrash位置,将其拷贝到debug用的文件夹下 执行命令 export DEVELOPER ...
- JSP基本_JSTL
自定义标签是,用户定义自己的处理的tag的机制. JSTL是,JSP用标准自定义标签.从JSTL Ver.1.2开始成为JavaEE5的子集.比较有名的是Glassfish.Tomcat上开发的话,需 ...
- Linux性能测试分析命令_sar
sar主要用于收集并统计系统资源的信息,包括CPU.IO.内存.网卡流量等. sar语法 用法:sar [ 选项 ] [ <时间间隔> [ <次数> ] ] 常用选项说明: - ...