zoukankan      html  css  js  c++  java
  • mysql相关配置

    简单配置

    mysql_secure_installation
    Enter current password for root (enter for none):<–初次运行直接回车
    Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
    New password: <– 设置root用户的密码
    Re-enter new password: <– 再输入一次你设置的密码
    Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
    Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
    Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
    Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车

    root 用户支持远程访问

    grant all privileges on *.* to '用户名'@'%' identified by '密码' with grant option;
    flush privileges;

    修改端口

    编辑配置文件

    vi /etc/my.cnf.d/server.cnf 

    在[mysqld]下增加端口

    [mysqld]
    port = 10086

    如果是mariadb

    vi /usr/lib/systemd/system/mariadb.service

    修改最大连接数

    增加

    在[Service]下面加入以下内容
    LimitNOFILE=10000
    LimitNPROC=10000

    然后

    systemctl daemon-reload
    systemctl restart mariadb

    查看最大连接数及修改

    SHOW VARIABLES LIKE '%max_con%';
    SET GLOBAL max_connections = 1000;

     查看等待时间及修改

    show global variables like 'wait_timeout';
    set global wait_timeout=600;

     mysql性能检测

    show processlist //查看所有线程
    set global slow_query_log = ON; // 打开slow.log
    SELECT * FROM mysql.`slow_log`; //查询慢的sql
  • 相关阅读:
    ASP.NET MVC的过滤器
    EasyUi 合并单元格占列显示
    Ajax异步请求阻塞情况的解决办法
    AutoFac使用总结
    CodeFirst迁移注意点
    DataTable与实体类互相转换
    mysql中注释的添加修改
    MySql修改数据表的基本操作(DDL操作)
    MySql中的约束
    如何使用单例模式返回一个安全的Connection
  • 原文地址:https://www.cnblogs.com/dongqiliang/p/12182161.html
Copyright © 2011-2022 走看看