简单,一是看到事物表面而觉得简单,另一是透彻事物本质而观着简单
#安装mysql5.7.32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
cmake .. -DCMAKE_INSTALL_PREFIX=/data/application/mysql5.7.32 \ -DMYSQL_DATADIR=/data/application/mysql5.7.32/data \ -DSYSCONFDIR=/data/application/mysql5.7.32/etc \ -DMYSQL_UNIX_ADDR=/data/application/mysql5.7.32/mysql.sock \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_SSL=/data/application/openssl1.1.1j \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DENABLED_PROFILING=0 \ -DWITH_BOOST=/data/software/mysql-5.7.32/boost ./bin/mysqld --initialize-insecure --datadir=/data/application/mysql5.7.32/data ./bin/mysqld_safe --defaults-file=/data/application/mysql5.7.32/etc/my.cnf --user=mysql & |
#安装percona5.7.32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
cmake .. -DCMAKE_INSTALL_PREFIX=/data/application/percona5.7.32 \ -DMYSQL_DATADIR=/data/application/percona5.7.32/data \ -DSYSCONFDIR=/data/application/percona5.7.32/etc \ -DMYSQL_UNIX_ADDR=/data/application/percona5.7.32/mysql.sock \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_SSL=/data/application/openssl1.1.1j \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DENABLED_PROFILING=0 \ -DWITH_BOOST=/data/software/mysql-5.7.32/boost ./bin/mysqld --initialize-insecure --datadir=/data/application/percona5.7.32/data ./bin/mysqld_safe --defaults-file=/data/application/percona5.7.32/etc/my.cnf --user=mysql & ./bin/mysqld --defaults-file=/data/application/percona5.7.32/etc/my.cnf --user=mysql & |
#安装mariadb10.5.8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
cmake3 .. -DCMAKE_INSTALL_PREFIX=/data/application/mariadb10.5.8 \ -DMYSQL_DATADIR=/data/application/mariadb10.5.8/data \ -DMYSQL_UNIX_ADDR=/data/application/mariadb10.5.8/mysql.sock \ -DSYSCONFDIR=/data/application/mariadb10.5.8/etc \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_ARIA_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_CONNECT_STORAGE_ENGINE=1 \ -DWITH_CSV_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DWITH_SEQUENCE_STORAGE_ENGINE=1 \ -DWITH_SPHINX_STORAGE_ENGINE=1 \ -DWITH_XTRADB_STORAGE_ENGINE=1 \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DEXTRA_CHARSETS=all \ -DENABLE_PROFILING=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_DEBUG=0 \ -DWITH_LIBWRAP=0 \ -DWITH_READLINE=1 \ -DWITH_SSL=/data/application/openssl1.1.1j ./scripts/mysql_install_db --basedir="/data/application/mariadb10.5.8" --defaults-file="/data/application/mariadb10.5.8/etc/my.cnf" #./bin/mysqld_safe --defaults-file=/data/application/mariadb10.5.8/etc/my.cnf --skip-grant-tables --skip-networking --user=mysql & ./bin/mysqld_safe --defaults-file=/data/application/mariadb10.5.8/etc/my.cnf --user=mysql & mysql -S mysql.sock --ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('root'); UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE User = 'root' AND Host = 'localhost'; |
#安装mysql8.0.22
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
export CC=/data/application/gcc5.5/bin/gcc export CXX=/data/application/gcc5.5/bin/g++ export LD_LIBRARY_PATH=/data/application/gcc5.5/lib64:/data/application/openssl1.1.1j/lib:$LD_LIBRARY_PATH cmake3 .. -DCMAKE_C_COMPILER=/data/application/gcc5.5/bin/gcc \ -DCMAKE_CXX_COMPILER=/data/application/gcc5.5/bin/g++ \ -DCMAKE_INSTALL_PREFIX=/data/application/mysql8.0.22 \ -DMYSQL_DATADIR=/data/application/mysql8.0.22/data \ -DSYSCONFDIR=/data/application/mysql8.0.22/etc \ -DMYSQL_UNIX_ADDR=/data/application/mysql8.0.22/mysqld.sock \ -DDEFAULT_CHARSET=utf8mb4 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DWITH_SSL=/data/application/openssl1.1.1j \ -DWITH_BOOST=/data/software/mysql-8.0.22/boost ./bin/mysqld --initialize-insecure --datadir=/data/application/mysql8.0.22/data ./bin/mysqld_safe --defaults-file=/data/application/mysql8.0.22/etc/my.cnf --user=mysql & |
上面openssl如果没有自己编译,可以使用system代替
boost如果已经下载妥当,按照上面的路径指定即可,否则可以在线下载-DDOWNLOAD_BOOST=1
#通用配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
[mysql] [client] socket=/data/application/mariadb10.4.20/mysql.sock [mysqld_safe] [mysqld] bind-address=0.0.0.0 port = 11042 server-id = 1001 sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION expire_logs_days = 1 pid-file=/data/application/mariadb10.4.20/mysql.pid socket=/data/application/mariadb10.4.20/mysql.sock plugin-dir=/data/application/mariadb10.4.20/lib/mysql/plugin log-error=/data/application/mariadb10.4.20/mysqld.err datadir=/data/application/mariadb10.4.20/data max_connections = 800 max_connect_errors = 3000 max_allowed_packet = 33554432 #binlog log-bin=/data/application/percona5.7.32/log/binlog log-bin-index=/data/application/percona5.7.32/log/binlog.index binlog_format = ROW sync_binlog = 1 #GTID(mariadb不用配) gtid_mode=on enforce_gtid_consistency=on #mysql8.0修改认证方式(默认是caching_sha2_password) #default_authentication_plugin=mysql_native_password |
#创建用户:
1 2 3 4 5 6 7 8 |
#系统自带的mysql客户端可能存在版本低不匹配的问题,所以使用每个版本自带的mysql一般就不会出现问题 ./bin/mysql -S mysql.sock #ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; CREATE USER `test1234`@`%` IDENTIFIED BY 'test1234'; GRANT ALL PRIVILEGES ON *.* TO 'test1234'@'%'; FLUSH PRIVILEGES; |