linux中安装mysq5.7

linux中安装mysq5.7

一. 安装mysql

yum install mariadb-server mariadb

二. 开启mysql

service mysqld start 

四. 停止mysql服务

service mysqld stop

五. mysql配置文件修改为免密码登录。

# vi /etc/my.cfg
# Disabling symbolic-links is recommended to prevent assorted security risks
skip-grant-tables #添加这句话,这时候登入mysql就不需要密码
symbolic-links=0

六. 启动 mysql 服务

# service mysqld start

七. 以root身份登录mysql, 输入密码的时候直接回车 

# mysql -uroot -p #输入命令回车进入,出现输入密码提示直接回车。
mysql> set password for root@localhost = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@localhost = password('123456'); or update user set authentication_string=PASSWORD("123456") where user="root";
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>flush privileges; #更新权限
mysql>quit; #退出
# service mysqld stop # 停止mysql服务, 恢复mysql配置
# vi /etc/my.cfg
# Disabling symbolic-links is recommended to prevent assorted security risks
# skip-grant-tables # 注释掉这句话
symbolic-links=0
# service mysqld start # 启动mysql服务
# mysql -uroot -p # 输入新密码登录

转载于:https://www.cnblogs.com/crazytata/p/10235190.html

你可能感兴趣的:(数据库,操作系统,运维)