linux下安装MySQL-5.6.31采用yumyinstall 命令安装的示例分析
发布时间:2022-01-13 11:29:08 所属栏目:编程 来源:互联网
导读:这期内容当中小编将会给大家带来有关linux下安装MySQL-5.6.31采用yum -y install 命令安装的示例分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。 1 安装前的准备 系统版本:linux(版本centos6.5 64位系统) 64位
这期内容当中小编将会给大家带来有关linux下安装MySQL-5.6.31采用yum -y install 命令安装的示例分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。 1 安装前的准备 系统版本:linux(版本centos6.5 64位系统) 64位操作系统 ; 下载好 MySQL MySQL-5.6.31-1.linux_glibc2.5.x86_64.rpm-bundle.tar mysql 下载官网:http://dev.mysql.com/downloads/file/?id=463181 [root@localhost mysql]# tar -ivh MySQL-5.6.31-1.linux_glibc2.5.x86_64.rpm-bundle.tar 开始安装 a 检查MySQL及相关RPM包,是否安装,如果有安装, 则移除(rpm –e 名称 或 yum -y remove 名称) [root@localhost mysql]# rpm -qa |grep -i mysql ## -i是不区分大小写 MySQL-client-5.6.31-1.linux_glibc2.5.x86_64 MySQL-server-5.6.31-1.linux_glibc2.5.x86_64 [root@localhost mysql]# rpm -e MySQL-client-5.6.31-1.linux_glibc2.5.x86_64 ## 两种移除方法都可以 [root@localhost mysql]# rpm -qa |grep -i mysql MySQL-server-5.6.31-1.linux_glibc2.5.x86_64 [root@localhost mysql]# yum -y remove MySQL-server-5.6.31-1.linux_glibc2.5.x86_64 Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5 will be erased --> Finished Dependency Resolution ........ Removed: MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5 Complete! 接下来安装服务端 和客户端:用 yum -y install 方式 1 先查看文件的详细信息 [root@localhost mysql]# ls -l 总用量 623100 -rw-r--r--. 1 7155 31415 23624679 5月 18 22:13 MySQL-client-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 4588279 5月 18 22:14 MySQL-devel-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 117877215 5月 18 22:14 MySQL-embedded-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 89759062 5月 18 22:15 MySQL-server-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 2424499 5月 18 22:15 MySQL-shared-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 5181145 5月 18 22:15 MySQL-shared-compat-5.6.31-1.linux_glibc2.5.x86_64.rpm -rw-r--r--. 1 7155 31415 75560152 5月 18 22:15 MySQL-test-5.6.31-1.linux_glibc2.5.x86_64.rpm [root@localhost mysql]# 我们只要安装红色的两个地方即可: 安装服务端: [root@localhost mysql]# yum -y install MySQL-server-5.6.31-1.linux_glibc2.5.x86_64.rpm Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile ................ Installed: MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5 Complete 安装完毕后启动服务: [root@localhost mysql]# /etc/init.d/mysql start Starting MySQL........ SUCCESS! (ps:假如你在这边启动服务的时候,出现报错:比如你mysql 是卸载掉后重新安装mysql的话,有可能会报这个错:Starting MySQL........................................................................................................ ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid). 这是你之前卸载的mysql localhost.localdomain.pid 进程没有杀干净,此时你可以先查看你进程号:ps -ef|grep -i mysqld 然后找到进程强制杀死 如下: [root@localhost mysql]# ps -ef|grep -i mysqld root 3643 1 0 13:48 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid mysql 3756 3643 1 13:48 pts/0 00:00:38 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid root 5023 1 0 14:48 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid mysql 5136 5023 6 14:48 pts/0 00:00:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid root 5282 2384 0 14:49 pts/0 00:00:00 grep -i mysqld [root@localhost mysql]# kill -9 3756 ## 5136 3756 的要是杀了没效果5136 的杀掉 [root@localhost mysql]# /etc/init.d/mysql start Starting MySQL.......... SUCCESS! ) [root@localhost mysql]# 查看 yum 安装后的默认密码: [root@localhost mysql]# cat /root/.mysql_secret # The random password set for the root user at Sun Jul 24 12:14:33 2016 (local time): PwEYW3GrS6Yn1kp2 接下来安装客户端 [root@localhost mysql]# yum -y install MySQL-client-5.6.31-1.linux_glibc2.5.x86_64.rpm Loaded plugins: fastestmirror, refresh-packagekit, security ...................... Installed: MySQL-client.x86_64 0:5.6.31-1.linux_glibc2.5 Complete! [root@localhost mysql]# rpm -qa |grep -i mysql MySQL-client-5.6.31-1.linux_glibc2.5.x86_64 MySQL-server-5.6.31-1.linux_glibc2.5.x86_64 [root@localhost mysql]# 此时 可以看到服务端客户端都安装好了,现在开始登陆 这边登陆之前说明下,如果你是之前下已经安装过mysql ,并且是修改过随机密码 :PwEYW3GrS6Yn1kp2(每个人的随机密码不一样哈) 然后再重新安装的话 ,你这时候再cat /root/.mysql_secret 虽然还会是 PwEYW3GrS6Yn1kp2 这个,但是这时候,我们登陆mysql: mysql -uroot -hlocalhost -p [root@localhost ~]# mysql -uroot -hlocalhost -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@localhost ~]# 会出现这个错误,就是登陆不了,因为这时候密码不是这个了,而是你之前修改的过得密码,我这边还不知道是什么原因,总之我用卸载之前用的密码重新登陆,就登陆成功了: [root@localhost ~]# mysql -uroot -hlocalhost -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 5 Server version: 5.6.31 MySQL Community Server (GPL) .......................................... Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> 可能是有些地方没有完全卸载干净吧,导致记录了之前的用户信息。这个以后再查证 假如你是之前这个系统重来还没安装过 mysql ,那么你登陆后,输入随机密码,就会登陆成功,成功查看数据库 mysql> show databases; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement mysql> set password=password('123456'); Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> use mysql Database changed mysql> 上述就是小编为大家分享的linux下安装MySQL-5.6.31采用yum -y install 命令安装的示例分析了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。 (编辑:广西网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐