问答详情
源自:4-1 LAMP之安装Mysql

cmake怎么使用呀。讲的粗心大意的。卧槽

cmake \ 命令无效呀

提问者:sunflower_boy 2018-09-19 01:07

个回答

  • KID4
    2019-01-04 15:12:42
    已采纳

    1. tar -jxvf mysql.tar.bz2

    2. yum install -y git gcc gcc-c++ ncurses ncurses-devel bison cmake libaio-devel openssl openssl-devel

    3. groupadd mysql; useradd -g mysql mysql

    4. tar -jxvf boost.tar.bz2

    5. cd /usr/local/boost

    6. ./bootstrap.sh --prefix=/usr/local/include/boost

    7. ./b2 install

    8. 

    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  \

    -DMYSQL_DATADIR=/usr/local/mysql/data/ -DSYSCONFDIR=\etc\mysql \

    -DWITH_INNOBASE_STORAGE_ENGINE=1   \

    -DMYSQL_TCP_PORT=3306   \

    -DENABLED_LOCAL_INFILE=1   \

    -DEXTRA_CHARSETS=all   \

    -DDEFAULT_CHARSET=utf8   \

    -DDEFAULT_COLLATION=utf8_general_ci  \

    -DWITH_BOOST=/usr/local/src/boost/boost_1_67_0/

    -DDOWNLOAD_BOOST=1


    9. make

    10. make install


    # 初始化mysql

    11. cd /usr/local/mysql

    12.(/usr/local/mysql/data/ 目录必须NULL)

    bin/mysqld --initialize --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/

    13. bin/mysql_ssl_rsa_setup

    14. cp ./support-files/my-default.cnf /etc/my.cnf 

    15. vim /etc/my.cnf

    [mysqld]

    datadir=/usr/local/mysql/data/

    socket=/var/lib/mysql/mysql.sock

    user=mysql

    character-set-server=utf8mb4

    port=3306

    # Settings user and group are ignored when systemd is used.

    # If you need to run mysqld under a different user or group,

    # customize your systemd unit file for mariadb according to the

    # instructions in http://fedoraproject.org/wiki/Systemd


    [mysqld_safe]

    log-error=/var/log/mariadb/mariadb.log

    pid-file=/var/run/mariadb/mariadb.pid


    #

    # include all files from the config directory

    #

    !includedir /etc/my.cnf.d


    16. vim /etc/environment   need reboot

    在PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"中加入“:/usr/local/mysql/bin”


    17. cd /usr/local/mysql

    18. cp support-files/mysql.server /etc/init.d/mysql.server

    19. service mysql.server start (临时密码在此)

    20. 修改密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

    可能还会有问题,我这样配置成功了,整理了一下


  • Nomyself
    2018-10-07 16:42:22

    哈哈,他是复制粘贴的配置信息