linux编译、运行mysql源码

1. execute cmake

cmake -DCMAKE_INSTALL_PREFIX=/home/mysql_build -DMYSQL_DATADIR=/home/mysql_build/data/data -DSYSCONFDIR=/home/mysql_build/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/home/mysql_build/bin/mysql.sock -DMYSQL_TCP_PORT=6303 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_BOOST=/usr/local/boost -DWITH_DEBUG=1

2. make && make install

3. mkdir ./etc && cp /home/mysql_1/etc/my.cnf ./etc/

4. mkdir -p ~/data/data && mkdir -p ~/data/binlog && mkdir -p ~/data/relaylog

5. ./bin/mysqld --initialize-insecure --datadir=/home/mysql_build/data/data --basedir=/home/mysql_build

6. add skip-grant-tables to my.cnf

7. ./bin/mysqld --defaults-file=~/etc/my.cnf &

8. connect db with network: mysql -uroot -h192.168.0.156 -P6303

9. update user set Host="%", authentication_string=password("123456") where User='root';

10. flush privileges;

11. remove skip-grant-tables from my.cnf

12. start mysql again and try to connect db with passwd: mysql -uroot -h192.168.0.156 -P6303 -p'123456'

转载于:https://www.cnblogs.com/xinxinBlog/p/10890525.html

你可能感兴趣的:(数据库,c/c++)