mac 下安装mysql&启动

本文介绍如何安装 MySQL 5.7.13 版本并进行基本配置,包括解压文件、使用命令行初始化数据库、设置 root 用户密码等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0 概述

本文使用的mysql 版本mysql-5.7.13-osx10.11-x86_64.tar.gz。

1 安装过程

解压后:
sudo cp -r mysql-5.7.13-osx10.11-x86_64 /usr/local/mysql
切换到mysql 目录
执行安装初始化工作
sudo bin/mysqld –initialize –user=mysql

2017-07-22T05:01:47.646022Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-22T05:01:47.654989Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2017-07-22T05:01:47.839522Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-07-22T05:01:47.863475Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-22T05:01:47.927757Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: dd8f7f4e-6e9a-11e7-980f-1a7500a020c2.
2017-07-22T05:01:47.943281Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-07-22T05:01:47.948597Z 1 [Note] A temporary password is generated for root@localhost: w,<GP%%dg8Sh

注意这里最后一行,会生成一个root用户的密码
启动mysql:
sudo ./support-files/mysql.server start
切换到bin目录
执行命令:./mysql -u root -p
按照提示输入上面生成的密码即可进入mysql控制台
输入:ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass’;
更多可以参考:mysql 官方

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值