mac install mysql tutorial

mysql address of mac:
address: http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-osx10.10-x86_64.dmg

Double click to install
Insert picture description here

Note that during the installation process, MySQL has defaulted that the password of user root is no longer root, but a temporary password dynamically generated (eg root@localhost: yltGn*gPH9t,).

During the installation process, a pop-up window will appear to tell you the dynamic password. Be sure to remember this or copy the password, which is related to whether you can enter the database.

Configure environment variables
vi ~/.bash_profile

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysq

Environment Variables refresh
source ~/.bash_profile
start mysql
open "System Preferences"
Insert picture description here
to start
Insert picture description here
the interface after the start follows:
Insert picture description here
open a terminal enter the following:
mysql -u root -p
a note input password installed

After root login, change the password

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root123');
flush privileges; #立即刷新生效


Exit and restart the MySQL service

Create a new user & assign permissions, create a new database

1. Create a hive database, the character set is utf8

CREATE DATABASE hive DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

2. Create user fuyun

CREATE USER 'fuyun'@'localhost' IDENTIFIED BY 'fuyun123'; #本地登录

CREATE USER 'fuyun'@'%' IDENTIFIED BY 'fuyun123'; #远程登录

3. Grant permissions to user fuyun

GRANT ALL PRIVILEGES ON hive.* to 'fuyun'@'localhost' IDENTIFIED BY 'fuyun123'; #赋全部权限

GRANT select,create ON hive.* to 'fuyun'@'localhost' IDENTIFIED BY 'fuyun123'; #赋部分权限

flush privileges; #立即刷新

Insert picture description here

Guess you like

Origin blog.csdn.net/lz6363/article/details/107294207