Linux使用rpm包安装MySQL

(1)下载安装包
MySQL-server-5.5.51-1.rhel5.i386.rpm

MySQL-client-5.5.51-1.rhel5.i386.rpm

MySQL-devel-5.5.51-1.rhel5.i386.rpm
(2)开始安装
#rpm -ivh MySQL*.rpm
(3)查看端口占用
#netstat -nat
(4)启动,停止MySQL
#service mysql stop; 

#service mysql start; 
(5)设置root用户密码
#mysql -u root

#mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
(6)设置运行远程连接 
#mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

#mysql>FLUSH  PRIVILEGES;

#mysql>CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

#mysql>CREATE DATABASE db_name DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;