Centos6.5使用rpm安装mysql及双主互备模式。.docx
文本预览下载声明
Centos使用RPM命令安装MySQL数据检查MySQL及相关RPM包如果有安装,则移:[root@localhost ~]# rpm -qa | grep -i mysqlmysql-libs-5.1.66-2.el6_3.x86_64 [root@localhost ~]# rpm –e –nodeps mysql-libs-5.1.66-2.el6_3.x86_64 安装mysql[root@localhost rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm [root@localhost rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm [root@localhost rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm #修改配置文件位置 [root@localhost rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf 初使化MYSQL及配置密码[root@localhost rpm]# /usr/bin/mysql_install_db [root@localhost rpm]# service mysql start [root@localhost rpm]# cat /root/.mysql_secret #查看root账号密码 # The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl [root@localhost ~]# mysql -uroot –pqKTaFZnl mysql SET PASSWORD = PASSWORD(123456); #设置密码为123456 mysql exit [root@localhost ~]# mysql -uroot -p123456 允许远程登录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,password from user;+-----------------------+------+-------------------------------------------+?|?host??????????????????|?user?|?password?|??+-----------------------+------+-------------------------------------------+?|?localhost?????????????|?root?|?*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B?|??|?localhost.localdomain?|?root?|?*A4B8196FF869F64E0119B231785E5946EDBA5E26?|??|?127.0.0.1?????????????|?root?|?*A4B8196FF869F64E0119B231785E5946EDBA5E26?|??|?::1???????????????????|?root?|?*A4B8196FF869F64E0119B231785E5946EDBA5E26?|??+-----------------------+------+-------------------------------------------+?mysql update user set password=password(root) where user=root; Query OK, 3 rows affected (0.01 sec) Rows matched: 4 Changed: 3 Warnings: 0 mysql update user set host=% where user=root and host=localhost; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 mys
显示全部