• Mysql遇到的坑


    2018-04-09

    这个虽然跟粗心有关,但是Mysql没报错是哪般?

    select sum(play_count) from tb_user_login where user_id = 61 and login_time > 2018-04-09

    结果:2157

    select sum(play_count) from tb_user_login where user_id = 61 and login_time > '2018-04-09'

    结果:6

    如果没有加引号,后面的条件直接无视了。。。

    2018-04-25

    数据库莫名死掉了,用/usr/local/mysql/bin/mysqld_safe --user=root&

    重启不了。

    [root@instance-4dxoa0fo mysql]# 180425 11:00:53 mysqld_safe Logging to '/data/mysql/mysql/data/error.log'.

    然后我就打开那个错误日志error.log

    2018-04-25 10:52:52 68841 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2018-04-25 10:52:52 68841 [Note] InnoDB: Using Linux native AIO
    2018-04-25 10:52:52 68841 [Note] InnoDB: Using CPU crc32 instructions
    2018-04-25 10:52:52 68841 [Note] InnoDB: Initializing buffer pool, size = 512.0M
    InnoDB: mmap(549453824 bytes) failed; errno 12
    2018-04-25 10:52:52 68841 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
    2018-04-25 10:52:52 68841 [ERROR] Plugin 'InnoDB' init function returned error.
    2018-04-25 10:52:52 68841 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2018-04-25 10:52:52 68841 [ERROR] Unknown/unsupported storage engine: InnoDB
    2018-04-25 10:52:52 68841 [ERROR] Aborting

    这一次好像是说512M的内存满足不了,我就百度,说在my.cnf配置里加 innodb_buffer_pool_size=128M   (参数改小一点)

    后来我用find / -name my.cnf找了好几个my.cnf , 然后我就每个都改,后来也没有生效。

    然后我输入

    mysql --help

    可以查看到一些配置信息,看到这句

    Default options are read from the following files in the given order:
    /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

    我就又回到/etc/my.cnf

    发现我明明改了参数,为什么没有生效,后来我发现有一个65%的参数,才知道原来可以下翻,

    下翻到后面我才发现,下面了有一个 innodb_buffer_pool_size=512M,原来因为它在后面,覆盖了我的设置

    后来改为128,重新启动就好了。

    2018-05-12

    遇到了密码忘记了,但是有保存在navcat里面的时候,可以重置密码:

    用他的方法一就行了:https://www.cnblogs.com/yang82/p/7794712.html

    下面是系统启动mysql的命令(备用)

    /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock --user=mysql

  • 相关阅读:
    反向传播错漏百出小推导
    使用git遇到的
    Cost Function in Logistic Regression and Neural Network
    鼠标左键长按功能的实现
    同类控件的统一操作(以TCHECKBOX为例)
    HLP帮助文件源文件RTF文件的编写
    FORMAT 的用法
    DELPHI6中DSGNINTF.DCU找不到时的解决方法
    使窗体处于可“移动”,可改变“大小”状态中
    系统菜单的控制,使菜单项灰显及恢复功能
  • 原文地址:https://www.cnblogs.com/angelshelter/p/8758515.html
Copyright © 2020-2023  润新知