#rpm -Uvh mysql-community-.rpm #下载的rpm包 #grep -i password /var/log/mysqld.log #查看初始密码 2018-02-22T03:20:16.752293Z 1 [Note] A temporary password is generated for root@localhost: g0>Aw5hf?qb: #mysql -uroot -p"g0>Aw5hf?qb:" #登陆数据库 mysql> set global validatepasswordpolicy=0; #修改密码只验证长度 mysql> set global validatepasswordlength=6; #密码长度必须要大于六位 mysql> alter user root@"localhost" identified by "123456"; #设置本地登陆密码为123456 ###以上配置临时有效 修改配置文件永久生效: #Vim /etv/my.cnf [mysqld] validatepasswordpolicy=0 validatepasswordlength=6 #systemctl stop mysqld #systemctl start mysqld 建表(相当与系统文件) 表必须保存在库里。 Mysql>show databases; #查看有哪些库 Mysql> show tables; #查看当前库里表 Mysql> desc 表名; #查看但前库表结构 Mysql> select from 表名; #查看这个表中的所有行和列 Mysql> select user,host from user; #查看user表中的 user,host两列的内容 Mysql> select user,host,selectpriv from user;*