• mysql5.5编译安装


    首先规划好

    端口:3306
    管理员名称:cool
    安装基本目录:/usr/local/mysql
    数据库目录:/data
    二进制日志目录:/var/log/mysqld
    延迟日志目录:/var/log/mysqld(延迟日志目录  这个还不怎么明白)
    启动文件:/var/run/mysqld

    添加mysql用户

    #groupadd -r mysql

    # useradd -r -g mysql -s /sbin/nologin mysql

    #cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=yes -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data  -DMYSQL_TCP_PORT=3306

    ENABLED_LOCAL_INFILE 是否开启客户端本地存储以减轻数据库的负载

    #make

    #make install

    #ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

    #ln -s /usr/local/mysql/bin/mysql /bin/mysql

    删除空密码、匿名的用户

    mysql> delete from mysql.user where password='';
    mysql> delete from mysql.user where user='';
    mysql> flush privileges;

    创建数据库管理帐户,允许远程用户访问。并将root更名为其他名称

    mysql> CREATE USER 'cool'@'%' IDENTIFIED BY '123456';
    mysql> GRANT ALL ON *.* TO 'cool'@'%' WITH GRANT OPTION;
    mysql> RENAME USER 'root'@'localhost' TO 'cool'@'localhost';
    mysql> flush privileges;

    安全

    除了管理员帐号外,不要把file, process, super,reload,shutdown,grant权限授予管理员以外的账号

    update mysql.user set file_priv = 'N' Where User=user_name and host =
    host_name
    update mysql.user set process_priv = 'N' Where User=user_name and host =
    host_name
    update mysql.user set super_priv = 'N'Where User=user_name and host =
    host_name
    update mysql.user set reload_priv = 'N' Where User=user_name and host =
    host_name
    update mysql.user set shutdown_priv = 'N' Where User=user_name and host =
    host_name
    update mysql.user set grant_priv = 'N' Where User=user_name and host =
    host_name

  • 相关阅读:
    iOS APP程序启动原理
    关于组合式继承和寄生式继承的个人理解
    servlet session 相关
    hadoop配置远程客户端
    将普通工程转为mvn标准工程(main resources)
    log4j2 配置文件
    mvn生成runnablejar 的方法
    普通工程转为mvn工程
    java ReentrantLock可重入锁功能
    在mapreduce中做分布式缓存的问题
  • 原文地址:https://www.cnblogs.com/cool4ever/p/5238824.html
Copyright © 2020-2023  润新知