1.Mysql
1.1 安装mysql
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
1.1.2 安装后重启
service mysqld restart
1.1.3 初次安装mysql,root账户没有密码,登录Mysql:
mysql -u root
1.1.4 设置密码
mysql> set password for 'root'@'localhost' =password('123456');
1.1.5 不需要重启就生效
mysql -u root -p
1.2 卸载mysql
1.2.1 通过 rpm 查找 MySQL
rpm -qa|grep -i mysql
1.2.2 查看 MySQL 运行状态
systemctl status mysqld.service
1.2.3 关闭 MySQL 服务
systemctl stop mysqld.service
1.2.4 通过 yum remove 删除 MySQL 安装包
先使用这个查询
rpm -qa|grep -i mysql
查询的结果mysql-community-common-5.6.51-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-client-5.6.51-2.el7.x86_64
mysql-community-libs-5.6.51-2.el7.x86_64
mysql-community-server-5.6.51-2.el7.x86_64
进行删除yum remove mysql-community-common-5.6.51-2.el7.x86_64
1.2.5 删除 MySQL 相关文件
查询命令
find / -name mysql
查询结果/etc/selinux/targeted/active/modules/100/mysql
/usr/share/mysql
/var/lib/mysql
/var/lib/mysql/mysql
rm -rf
递归删除上面查找到的所有 MySQL 相关文件
这个文件也要删除,正常执行完上面的已经没有了/etc/my.cnf
1.3 创建数据和修改数据库字符集
mysql> create database mall_ams;
mysql> alter database mall_ams charset utf8;