linux
下载 https://downloads.mysql.com/archives/community/
Compressed TAR Archive, Minimal Install 不包含调试和测试工具
1 | xz -d mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz |
用户组
1 | #添加组 |
初始化数据库
1 | $ sudo /opt/mysql/bin/mysqld --initialize --user=mysql --console |
……
—-2022-01-30T00:14:24.872326+08:00 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost:
bDB,fVSmt2/U
修改配置
默认/etc/my.cnf
1 | url=/opt/mysql |
开机启动
1 | sudo cp /opt/mysql/support-files/mysql.server /etc/init.d/mysql |
密码
1 | ##### 临时密码登录,执行语句提示 You must reset your password using ALTER USER statement before executing this statement. |
win
下载地址:http://dev.mysql.com/downloads/mysql/
管理员权限运行cmd
1 | E:\MySQL\MySQL Server 5.7\bin>mysqld install MySQL --defaults-file="E:\MySQL\MySQL Server 5.7\my.ini" |
install/Remove of the Service Denied!
1 | bin>mysqld --initialize --user=mysql --console |
启动服务
1 | net start MySQL |
删除
1 | sc delete MySQL |
other
Permission denied
检查目录所属用户mysql
rm /tmp/mysql*
1 | ❯ ls -l /tmp/mysql* |
端口
1 | /opt/mysql/bin/mysqld --initialize-insecure --user=mysql --lower-case-table-names=1 |
╰─❯ 2023-06-04T11:50:10.086155Z 0 [System] [MY-010116] [Server] /opt/mysql/bin/mysqld (mysqld 8.0.32) starting as process 5008
2023-06-04T11:50:10.089112Z 0 [Warning] [MY-010122] [Server] One can only use the –user switch if running as root
2023-06-04T11:50:10.094189Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-06-04T11:50:10.195060Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-06-04T11:50:10.385679Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-06-04T11:50:10.385746Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-06-04T11:50:10.386292Z 0 [ERROR] [MY-010262] [Server] Can’t start server: Bind on TCP/IP port: Address already in use
2023-06-04T11:50:10.386343Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2023-06-04T11:50:10.386383Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-06-04T11:50:11.974477Z 0 [System] [MY-010910] [Server] /opt/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
1 | sudo netstat -apn | grep 3306 |