mysql57-3306]# vim my.cnf
mysqld]
character-set-server=utf8
user=mysql
port=3306
basedir=/home/mysql/mysql57-3306
datadir=/home/mysql/mysql57-3306/data
socket=/home/mysql/mysql57-3306/socket/mysql.sock
pid-file=/home/mysql/mysql57-3306/pid/mysql.pid
log-error=/home/mysql/mysql57-3306/logs/mysql.log
mysql57-3306]# mkdir data pid socket logs
mysql57-3306]# touch pid/mysql.pid socket/mysql.sock logs/mysql.log
mysql57-3306]# chown -R mysql.mysql ./
mysql57-3306]# ll pid socket/ logs/
初始化数据库
mysql57-3306]# bin/mysqld --initialize --user=mysql --datadir=/home/mysql/mysql57-3306/data --basedir=/home/mysql/mysql57-3306
给数据库加密
mysql57-3306]# bin/mysql_ssl_rsa_setup --defaults-file=./my.cnf
启动
mysql57-3306]# /bin/sh bin/mysqld_safe --defaults-file=./my.cnf &
连接数据库
bin/mysql -h127.0.0.1 -P 3326 -uroot -p
修改密码
update mysql.user set authentication_string=password(“新密码”) where User=”test” and Host=”localhost”;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxx'; xxx是你自己定义的密码。
flush privileges;
赋予授权
grant all on *.* to root@'%' identified by '123456';
grant select,insert,update on luo.luo to luo@'%' identified by '123456';
撤销授权
revoke all on *.* from root@'%';
查看权限
show grants for data_a;
授权
grant select,insert,update,create,alter,references,index on `data_aggregation`.* to 'data_a'@'%';