问题:

我这里时应为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引起的问题的更多相关文章

  1. 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 ...

  2. Mac mysql 解决中文乱码

    Mac mysql 解决中文乱码问题 出现"???"之类的无法识别的乱码 到/etc目录下自己建一个my.cnf文件(需要最高权限,使用sudo su),然后写入内容: [clie ...

  3. Mac - MySQL初始密码忘记重置MySQL root密码

    在什么情况下,需要重置root密码呢?那就是我们忘记了.还有一种比较坑的,那就是笔者的这种情况.按照正常的情况下,MySQL安装完之后,会弹出一个对话框,显示着一个临时的root密码,但无论笔者如何重 ...

  4. mac mysql 编码配置

    mac mysql 编码配置 (mysql目录下没有my.cnf) 想要修改编码发现自己的/usr/local/mysql/support-files里面根本没有my.cnf 安装方式是去mysql官 ...

  5. Mac Mysql [ERR] 2006 - MySQL server has gone away

    Mac mysql 安装后,导入sql数据,出现这个错误: 处理方式,是因为sql文件太大,需要修改mysql的配置.如果没有my.cnf就自己建一个. cd /etc sudo vim my.cnf ...

  6. mac mysql 使用注意事项

    mac mysql 使用注意事项 .安装 直接通过下载官网上的dmg安装包进行安装,mysql--osx10.-x86_64(我的安装文件) ,安装完成后在系统偏好设置里面有mysql选项,我们可以通 ...

  7. Mac Mysql 5.6.4修改初始化密码

    Mac Mysql 修改初始化密码   第一步: 点击系统偏好设置->最下边点MySQL,在弹出页面中,关闭服务 第二步:进入终端输入:cd /usr/local/mysql/bin/回车后 登 ...

  8. mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径

    首先去官网下载: http://www.mysql.com/downloads/ 我下载了5.6.11的dmg然后安装,安装完成之后..如果要用终端去玩SQL.那么一开始要输入很长的:/usr/loc ...

  9. Mac Mysql初始密码重置

    今天晚上mac更新后重装MySQL 安装完成后 启动服务,死活登录不了 提示1045错误.按照网上的资料对MySQL密码进行重置.记录步骤如下: 1.首先关闭MySQL服务 系统偏好设置->最下 ...

随机推荐

  1. Windows下卸载Apache、Mysql

    卸载Apache 1. 停止服务 2.以管理员身份打开命令环境 3. 删除Apache文件目录 卸载Mysql 一.在控制面板,卸载MySQL的所有组件控制面板——>所有控制面板项——>程 ...

  2. 利用STM32CubeMX来生成USB_HID_host工程

    修改时钟(备注这边使用25mhz的主晶振) 选择debug_level等级为3

  3. 通过HTTP请求响应过程了解HTTP协议

    通过HTTP请求响应过程了解HTTP协议 http://www.cnblogs.com/YeChing/p/6337378.html

  4. JDK7和JDK8concurrentHashmap区别

    哈希表 1.介绍 哈希表就是一种以 键-值(key-indexed) 存储数据的结构,我们只要输入待查找的值即key,即可查找到其对应的值. 哈希的思路很简单,如果所有的键都是整数,那么就可以使用一个 ...

  5. Scrapy框架--代理和cookie

    如何发起post请求? 代理和cookie: cookie:豆瓣网个人登录,获取该用户个人主页这个二级页面的页面数据. 如何发起post请求? 一定要对start_requests方法进行重写. 1. ...

  6. 原生java读取存储为xml格式的数据,并存储到java bean里

    一.举例读取的文件为:X-bond可交易债券信息_20180917.xml <?xml version="1.0" encoding="UTF-8"?&g ...

  7. linux 排查page的状态问题

    最近遇到一个page的释放异常的问题,堆栈如下: [ 1000.691858] BUG: Bad page state in process server.o pfn:309d22 [ mapcoun ...

  8. WebRequest + Https + 憑証錯誤 = 作業逾時

    前言 一般的系統一登入時,都會顯示公告訊息,我們的系統也是! 因為系統效能問題,所以就幫忙看了程式.發現,每次登入時,都會到DB取公告資料,但公告並不會因為個人而有所不同,是針對整個系統的呀! 所以就 ...

  9. 第三条博客 你好 Java web!

    今天周五了,明天就是周末!第一个周末就这样结束了 今天我学习了MyEclipse开发 Javaweb 程序,学的是最基础的那一部分 首先先创建了自己的项目,展开项目标签,编辑index.jsp. 我还 ...

  10. ArcGIS案例学习笔记2_2_模型构建器和山顶点提取批处理

    ArcGIS案例学习笔记2_2_模型构建器和山顶点提取批处理 计划时间:第二天下午 背景:数据量大,工程大 目的:自动化,批处理,定制业务流程,不写程序 教程:Pdf/343 数据:chap8/ex5 ...