标签:oca 存储 package conf 0.00 monit 命令操作 mirror 重置
1、 下载mysql-5.7.10-linux-glibc2.5-i686.tar.gz6、登录mysql,此版本最新版不许空密码登录,实际上有个初始化密码保存在/root/.mysql_secret这个文件里面,用这个密码第一次登录后,再修改密码。因此先cat查看下初始化密码(随机的,每次安装看到的密码都不一样):
[root@localhost ~]# cat /root/.mysql_secret
:5ul#H6dmcwX
利用初始化密码:5ul#H6dmcwX开始登录mysql:
设置环境变量:vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
[root@localhost ~]# cd /usr/local/mysql/bin
[root@localhost bin]# ./mysql -uroot -p:5ul#H6dmcwX
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.10
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql>
显示登录成功,可以执行mysql命令操作了!
7、改mysql的root密码,新密码在此为‘leizm‘
mysql> set password=password(‘ 123456‘);
Query OK, 0 rows affected, 1 warning (0.00 sec)
Mysql> flush privileges;
8、设定远程登录mysql。在Linux下为了安全,默认是不允许mysql本机以外的机器访问mysql数据库服务,因此需要重新授权root。方便远程访问。
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select Host,User from user;
+-----------+-----------+
| Host | User |
+-----------+-----------+
| % | root |
| localhost | mysql.sys |
| localhost | root |
+-----------+-----------+
3 rows in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON . TO root@‘%‘ identified by ‘ 123456 ‘;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
授权语句最后的‘rxh@2016’是mysql数据库root用户的新密码。
9、非必要的步骤,如果远程连不上,估计是防火墙的问题,关闭试试:
[root@localhost mysql]# service iptables stop
setenforce 0iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
[root@localhost mysql]# setenforce 0
setenforce: SELinux is disabled
cp mysql.server /etc/rc.d/init.d/
mv mysql.server mysqld
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysqld
重置mysql密码
service mysqld stop
运行mysqld_safe --skip-grant-tables &
如果此时不想被远程连接:mysqld_safe --skip-grant-tables --skip-networking &
使用mysql连接server
更改密码: update mysql.user set authentication_string=password(‘123qwe‘) where user=‘root‘ and Host = ‘localhost‘;
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
而是将加密后的用户密码存储于authentication_string字段
mysql> flush privileges;
mysql> quit;
标签:oca 存储 package conf 0.00 monit 命令操作 mirror 重置
原文地址:http://blog.51cto.com/980696/2143990