Mysql安装-Centos7-阿里云虚拟主机
好久就没有这台机子了,之前重装了一次系统,个人觉得,ubuntu不太会用,就装成了centos。
- -这是mysql官网地址: https://dev.mysql.com/doc/refman/8.0/en/mysql-innodb-cluster-clone-deployment.html
- 第一步,先到这里面下载rpm包,根据你自己系统下载。
- 放到你的虚拟机或者服务器上。在所在目录下,输入:rpm -ivh *****.rpm(你的ipm包名称);
- 更新yum。:yum update
- 安装:yum install mysql-server
- 权限设置:chown mysql:mysql -R /var/lib/mysql
- 初始化:mysqld --initialize
- 验证:mysqladmin --version
[root@izwz97473w2ydu1pgsmzk4z ~]# mysqladmin --version mysqladmin Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)
之后就是登陆了,比较容易踩坑的一个地方,我看网上有的博客或者什么教材说,[root@host]# mysqladmin -u root password “new_password”;这条命令可以重置密码,试了下,不行,习惯性的查看错误日志,竟然有意外收获,图片下方代码就是我的日志打印,细心的同学会发现,人家给了你密码,你可以粘贴使用,注意,用mysql -u root -p而不是mysqladmin这个命令。- 设置密码:set password=“your password”;
- 之后退出,就可以用这个密码登录进来了,亲测有效。
[root@izwz97473w2ydu1pgsmzk4z ~]# tial -f /var/log/mysqld.log
-bash: tial: command not found
[root@izwz97473w2ydu1pgsmzk4z ~]# tail -f /var/log/mysqld.log
2019-08-03T13:03:22.556019Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server in progress as process 6513
2019-08-03T13:03:26.835389Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: k+S#R3I#0uxG
2019-08-03T13:03:28.016509Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server has completed
2019-08-03T13:07:25.492366Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 6628
2019-08-03T13:07:27.086301Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-08-03T13:07:27.109625Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.17' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2019-08-03T13:07:27.326713Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060