Mysql安装手册-yum方式

原创
03/01 16:49
阅读数 123

0.前置条件
os基于CentOS7
#wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
#yum -y install mysql57-community-release-el7-10.noarch.rpm
1、安装mysql 服务器端&客户端:
yum install mysql-community-server
2、启动mysql服务:
启动:
service mysqld start或者/etc/init.d/mysqld start
停止:
service mysqld stop
重启:
service mysqld restart
3、通过日志查看root口令
通过/etc/my.cnf查看日志位置
默认在日志中记录创建root账号的临时密码
通常在这里查看/var/log/mysqld.log
4、登录mysql修改root口令
mysql> set password=password('123456');
【mysql忘记root口令怎么办】
1、yum install mysql-server mysql-client
2、service mysqld start
3、vim /etc/my.cnf最后一行加
skip-grant-tables
4、service mysqld restart
5、此时即可跳过密码进入mysql
#mysql -P 3306
mysql> select * from mysql.user where user = 'root';
mysql> select * from mysql.user where user = 'root'\G
mysql> update mysql.user set authentication_string = password('123456') where user = 'root';
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
6、配置文件去掉skip-grant-tables
#vim /etc/my.cnf
#service mysqld restart
#mysql -P 3006 -p123456

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password = password('root')';
    '> ^C
mysql>  set password = password('root');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>  set password = password('root123456_');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>  set password = password('root123456789_#$%');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)
mysql>  set password = password('root');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>  set global validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
mysql> set password = password('root12');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit
Bye

展开阅读全文
打赏
0
0 收藏
分享
加载中
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部