MySql的安装
一。使用yum安装
1. 直接yum安装
(1). wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
或者centos7的mysql5.x:http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
(2). rpm -ivh mysql-community-release-el6-5.noarch.rpm
(3). yum -y install mysql-community-server
(5). service mysqld restart
2. /etc/my.cnf 配置文件
[root@VM_14_49_centos ~]# cat /etc/my.cnf [mysqld] port=3306 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql ........
3. 修改密码为12345
/usr/bin/mysqladmin -u root password '12345'
/usr/bin/mysqladmin -u root -p旧密码 password 新密码
4. 本地登录
mysql -u root -p12345
5. 打开 root 用户用密码1234远程登录(不需要是root的密码12345)
mysql> grant all privileges on *.* to root @"%" identified by "1234";
(一般不打开远程登录,可在登录端设置ssh秘钥登录后再本地登录)
二。mysql的卸载
1. 查找以前是否装有mysql
rpm -qa|grep -i mysql
2. 删除mysql
rpm -e --nodeps mysql*
3. 查找MySQL文件夹
find / -name mysql
4. 删除