标签:文件拷贝 开机 word test oca gre 嵌入式 命令执行 ase
yum remove mysql mysql-server mysql-libs mysql-server;
2. 执行find命令,查找MySQL的残留文件,然后运行“rm -rf 文件名”删除残留的MySQL文件
find / -name mysql
MySQL-client-advanced-5.6.20-1.el6.i686.rpm #MySQL客户端程序 MySQL-devel-advanced-5.6.20-1.el6.i686.rpm #MySQL的库和头文件 MySQL-embedded-advanced-5.6.20-1.el6.i686.rpm #MySQL的嵌入式程序 MySQL-server-advanced-5.6.20-1.el6.i686.rpm #MySQL服务端程序 MySQL-shared-advanced-5.6.20-1.el6.i686.rpm #MySQL的共享库 MySQL-shared-compat-advanced-5.6.20-1.el6.i686.rpm #RHEL兼容包 MySQL-test-advanced-5.6.20-1.el6.i686.rpm #MySQL的测试组件
一般对于开发而言,我们只需要下面三个文件就可以。
MySQL-client-advanced-5.6.20-1.el6.i686.rpm MySQL-devel-advanced-5.6.20-1.el6.i686.rpm MySQL-server-advanced-5.6.20-1.el6.i686.rpm
1. 在重新进行安装之前,为确保万无一失,我们还是再确认一下系统中是否有MySQL极其相关的RPM安装包。如果有,则先删除。
rpm -qa | grep -i mysql
执行完上述命令后,返回空数据,则可进行第二步。否则,执行下面的命令删除MySQL的相关包文件。
yum -y remove mysql-libs*
2. 将前面提到的三个MySQL安装文件,拷贝到服务器,然后执行下述安装命令。
rpm -ivh MySQL-server-advanced-5.6.20-1.el6.i686.rpm rpm -ivh MySQL-devel-advanced-5.6.20-1.el6.i686.rpm rpm -ivh MySQL-client-advanced-5.6.20-1.el6.i686.rpm
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
4.分别运行下述命令,初始化MySQL及设置密码。
/usr/bin/mysql_install_db #初始化MySQL service mysql start #启动MySQL cat /root/.mysql_secret #查看root账号的初始密码,会出现下述所示信息 # The random password set for the root user at Mon Aug 25 10:26:57 2014 (local time): ZFRmqNPoFH3aO5PU mysql -uroot -pZFRmqNPoFH3aO5PU #使用root账号登陆MySQL set password=password(‘123456‘); #更改MySQL密码,注意;不可少 exit #退出 mysql -uroot -p123456 #使用新密码登陆
5.配置允许远程登陆。
use mysql; mysql> select host,user,password from user; +-----------+------+-------------------------------------------+ | host | user | password | +-----------+------+-------------------------------------------+ | localhost | root | *DFEB299B8A17E376E7804A115F471149953B5645 | | chenxu | root | *6E4C48EDF3CC66BC5F6E6C0980935C8ED660EFAA | | 127.0.0.1 | root | *6E4C48EDF3CC66BC5F6E6C0980935C8ED660EFAA | | ::1 | root | *6E4C48EDF3CC66BC5F6E6C0980935C8ED660EFAA | +-----------+------+-------------------------------------------+ 4 rows in set (0.00 sec) mysql> update user set password=password(‘aqjccmtj‘) where user=‘root‘; Query OK, 3 rows affected (0.00 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.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye
6.设置开机启动
[root@favccxx local]# chkconfig mysql on [root@favccxx local]# chkconfig --list | grep mysql mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
character_set_server=utf8 character_set_client=utf8 collation-server=utf8_general_ci lower_case_table_names=1 max_connections=1000
8.MySQL的默认文件路径
/var/lib/mysql/ #数据库目录 /usr/share/mysql #配置文件目录 /usr/bin #相关命令目录 #启动脚本
9.重启MySQL
[root@favccxx local]# service mysql restart Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!
标签:文件拷贝 开机 word test oca gre 嵌入式 命令执行 ase
原文地址:http://www.cnblogs.com/perfect-yuewei/p/7063064.html