标签:
CentOs6.4
Mysql5.6.27
CentOs6.4
Mysql5.6.27
卸载系统mysql:
rpm -qa|grep -i mysql
rpm -e --nodeps xxx
# linux
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local
ln -s mysql-5.6.27-linux-glibc2.5-x86_64 mysql
cd mysql
# 将mysql/bin加入环境变量,也就是/etc/profile文件中
# 加入默认配置文件
bin/my_print_defaults --defaults-file=/usr/local/mysql/my.cnf
# 初始化数据文件
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/mysql3306
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/mysql3307
# 然后出来一大段英文大概教你怎么做
# 启动后先改密码
# 否则执行时指定配置文件
mysqld_multi --defaults-extra-file=/usr/local/mysql/my.cnf report
# or
mysqld_multi --defaults-file=/usr/local/mysql/my.cnf report
# or
mysqld_multi report
# 查看
mysqld_multi report
# 启动
mysqld_multi start 3306
# 停止
mysqld_multi stop 3306 --password=root
#or 最好用这个
mysqladmin -S /tmp/mysql_3306.sock -uroot -p shutdown
# 改密码
mysqladmin -S /tmp/mysql_3307.sock -u root password ‘root‘
# 创建授权新用户,开始使用
GRANT ALL PRIVILEGES ON test.* TO ‘hive_user‘@‘%‘ IDENTIFIED BY ‘hive_user‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘hive_user‘@‘%‘ IDENTIFIED BY ‘hive_user‘ WITH GRANT OPTION;
revoke all on *.* from ‘hive_user‘@‘%‘;
revoke all on test.* from ‘hive_user‘@‘‘;
FLUSH PRIVILEGES;
delete from mysql.user where user=‘hive_user‘;
revoke all on *.* from ‘hive_user‘@‘%‘;
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO ‘dev‘@‘%‘ IDENTIFIED BY ‘dev123456‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
delete from mysql.user where user=‘dev‘;
标签:
原文地址:http://www.cnblogs.com/blazer/p/4958166.html