mysql编译安装

下载

https://downloads.mysql.com/archives/community/

编译

tar -xf ~/Downloads/mysql-boost-8.0.28.tar.gz 
cd mysql-8.0.28/
mkdir build 
cd build/
cmake .. -DCMAKE_INSTALL_PREFIX=/home/XXX/install/mysql/mysql-8.0.28 -DMYSQL_DATADIR=/home/XXX/install/mysql/data -DSYSCONFDIR=/home/XXX/install/mysql/cfg -DDEFAULT_CHARSET=utf8 -DWITH_BOOST=/home/XXX/workspace/tmp/mysql-8.0.28/boost
make -j40
make install

启动

初始化

$ ./mysql-8.0.28/bin/mysqld --initialize
2022-05-15T17:46:08.742229Z 0 [System] [MY-013169] [Server] /home/XXX/install/mysql/mysql-8.0.28/bin/mysqld (mysqld 8.0.28) initializing of server in progress as process 114909
2022-05-15T17:46:10.849149Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-05-15T17:46:53.636402Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-05-15T17:48:55.856219Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: :rY3:PEie3cF

启动

$ ./mysql-8.0.28/bin/mysqld 
2022-05-15T17:50:03.958083Z 0 [System] [MY-010116] [Server] /home/XXX/install/mysql/mysql-8.0.28/bin/mysqld (mysqld 8.0.28) starting as process 115074
2022-05-15T17:50:04.343787Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-05-15T17:50:10.005956Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-05-15T17:50:19.474029Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-05-15T17:50:19.474116Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-05-15T17:50:20.653181Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2022-05-15T17:50:20.653218Z 0 [System] [MY-010931] [Server] /home/XXX/install/mysql/mysql-8.0.28/bin/mysqld: ready for connections. Version: '8.0.28'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution.

登录并修改root密码

$ ./bin/mysql -u root -h 127.0.0.1 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.52 sec)

mysql> quit
Bye

$ ./bin/mysql -u root -h 127.0.0.1 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.28 Source distribution

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

参考

posted @ 2022-05-16 01:11  憶藝  阅读(114)  评论(0)    收藏  举报