mac 下安装mysql&启动

来源:互联网 发布:c编程思想pdf 编辑:程序博客网 时间:2024/05/16 01:35

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 insensitive2017-07-22T05:01:47.839522Z 0 [Warning] InnoDB: New log files created, LSN=457902017-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 官方

这里写图片描述

原创粉丝点击