mysql的安装和激活

使用方法等详细信息请关注公众号【生物信息分析学习】(swxxfxxx)

【提示】本文写作命令为:abysw blog mysql的安装和激活
【 另 】有任何问题,欢迎来公众号交流!

服务器坏了,MySQL又使用不了了,需要重新安装和分配账号。

yum -y install mariadb-server mariadb

systemctl start mariadb # 启动
systemctl enable mariadb # 开机启动
mysql_secure_installation # 安全配置

mysql -u root -p1qaz3edc # 登录
show databases;
exit;

abyss=Urname
create user abyss@’192.168…’ identified by ‘1qaz’;
grant all privileges on abyss_d.abyss_t to abyss@’192.168….’;

SET PASSWORD FOR ‘abyss‘@’192.168….’ = PASSWORD(“1234”);

drop user ‘username‘@’host’

create user ‘abyss‘@’localhost’ identified by ‘1qaz’;
grant all privileges on abyss_d.* to ‘abyss‘@’localhost’;

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

yum -y install mariadb-server mariadb
flush privileges;

阿里云Centos安装mysql教程
yum remove mariadb-server mariadb
wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
rpm -ivh mysql57-community-release-el7-7.noarch.rpm
rpm –import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql-server
yum -y install mysql-devel
yum -y install mysql
rpm -qa | grep -i mysql

service mysqld status
service mysqld stop
service mysqld restart
service mysqld start

systemctl enable mysqld

#cat /etc/my.cnf
#skip-grant-tables

mysql -u root -p1qaz3edc
show databases;

use mysql;
show tables;
select user,authentication_string from user;
update mysql.user set authentication_string=password(‘your password’) where user=’root’;
flush privileges;
exit;

GRANT SELECT ON . TO ‘pasa‘@’localhost’ IDENTIFIED BY ‘123456’
GRANT ALL ON . TO ‘chenyong‘@’localhost’ IDENTIFIED BY ‘123456’;

create user ‘abyss‘@’localhost’ identified by ‘1qaz’;
grant all privileges on abyss_d.* to ‘abyss‘@’localhost’;

drop user ‘username‘@’host’ # 删除账号
SET PASSWORD FOR ‘abyss‘@’192.168….’ = PASSWORD(“1234”); #改密码

开通读写和只读两种权限

mysql_upgrade -u root -p1qaz3edc
create user ‘abyss_w‘@’localhost’ identified by ‘123456’;
create user ‘abyss_r‘@’localhost’ identified by ‘123456’;
GRANT SELECT ON . TO ‘abysw_r‘@’localhost’ IDENTIFIED BY ‘123456’
GRANT ALL ON . TO ‘abysw_w‘@’localhost’ IDENTIFIED BY ‘123456’;
flush privileges;
exit