zoukankan      html  css  js  c++  java
  • 使用cmake安装单实例mysql

    使用cmake安装单实例mysql
    1、安装cmake
       

    a、解压cmake包
    b、编译
            ./configure
    c、安装
            make && make install

    2、安装依赖包
      

     yum install ncurses-devel -y

    3、创建mysql用户
      

     groupadd mysql
     useradd mysql -s /sbin/nologin -M -g mysql


     4、安装mysql
       a、使用cmake编译

     1 cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 
     2         -DMYSQL_DATADIR=/application/mysql-5.5.32/data 
     3         -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock 
     4         -DDEFAULT_CHARSET=utf8 
     5         -DDEFAULT_COLLATION=utf8_general_ci
     6         -DEXTRA-CHARSETS=gbk,gb2312,utf8,ascii 
     7         -DENABLED_LOCAL_INFILE=ON 
     8         -DWITH_INNOBASE_STORAGE_ENGINE=1 
     9         -DWITH_FEDERATED_STORAGE_ENGINE=1 
    10         -DWITH_BLACHHOLE_STORAGE_ENGINE=1 
    11         -DWITH_MYISAM_STORAGE_ENGINE=1 
    12         -DWITH_EXAMPLE_STORAGE_ENGINE=1 
    13         -DWITH_MEMORY_STORAGE_ENGINE=1 
    14         -DWITH_PARTITION_STORAGE_ENGINE=1 
    15         -DWITH-FAST-MUTEXES=1 
    16         -DWITH-ZLIB=bundled 
    17         -DENABLED_LOCAL_INFILE=1 
    18         -DWITH_READLINE=1 
    19         -DWITH-EMBEDDED-SERVER=1 
    20         -DWITH-DEBUG=0

       b、使用make安装

    make && make install

       c、创建连接

    ln -s /application/mysql-5.5.32/ /application/mysql

    5、配置mysql

    cp /application/mysql-5.5.32/support-files/my-small.cnf  /etc/my.cnf

    6、配置环境变量

    1 echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
    2 tail -l /etc/profile
    3 source /etc/profile
    4 echo $PATH

    7、初始化数据文件 

    1 mkdir –p /application/mysql/data
    2 chown –R mysql.mysql /application/mysql
    3 chmod -R 1777 /tmp/
    4 ./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql

    8、启动文件
     

    1 a、复制启动文件
    2         /bin/cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
    3 b、修改权限
    4         chown -R mysql.mysql /application/mysql/
    5         chmod +x /etc/init.d/mysqld
    6 c、启动mysql
    7         /etc/init.d/mysqld start

    9、删除用户为空的数据

    1 delete from mysql.user where user='';
    2 delete from mysql.user where host='::1';

    10、增加密码

    1     /application/mysql//bin/mysqladmin -u root password 'new-password'
    2     /application/mysql//bin/mysqladmin -u root -h jiajunpserver password 'new-password'
    3 
    4     /application/mysql/bin/mysqladmin -u root password 'root@123'

    11 开机自启动

    1 chkconfig mysqld on
    2 chkconfig --list mysqld

    12、丢失root密码找回

    a、停止数据库
            /etc/init.d/mysqld stop
    b、使用—skip-grant-tables启动数据库
            mysqld_safe –skip-grant-tables –user=mysql &
    c、使用update修改密码
            update mysql.user set password=password(“root”)  where user=’root’;
    d、刷新数据库
            flush privileges;
    e、关闭数据库
            mysqladmin –uroot –proot shutdown
    f、启动数据库
            /etc/init.d/mysqld start

    13、创建新用户并授权

    a、创建jiajunp用户并可以访问db1数据库
            grant all on db1.* to ‘jiajunp’@’localhost’ identified by ‘mypasswd’
    b、授权局域网内主机远程连接数据库
            grant all on test.* to jiajunp@’192.168.100.0/254’ identified by ‘jiajunp’;
  • 相关阅读:
    Spring框架之什么是IOC的功能?
    Spring框架的特点
    spring框架的概述与入门
    struts框架总结
    struts框架之总结OGNL表达式的特殊的符号
    struts框架值栈问题七之EL表达式也会获取到值栈中的数据
    struts框架问题六之从值栈中获取值
    struts框架问题五之向值栈中保存数据
    struts框架问题四之获取到值栈的对象
    java获取屏幕密度
  • 原文地址:https://www.cnblogs.com/jiajunplyh/p/12182738.html
Copyright © 2011-2022 走看看