安装MySQL
- 上传MySQL-server-5.5.48-1.linux2.6.x8664.rpm到Linux上
解压ta包 得到一大堆rpm文件
tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tarMySQL-client-5.6.25-1.el6.x86_64.rpm MySQL-devel-5.6.25-1.el6.x86_64.rpm MySQL-embedded-5.6.25-1.el6.x86_64.rpm MySQL-server-5.6.25-1.el6.x86_64.rpm MySQL-shared-5.6.25-1.el6.x86_64.rpm MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm MySQL-test-5.6.25-1.el6.x86_64.rpm
rpm安装mysql-server
rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm出现错误
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64- 卸载 mariadb-libs-1:5.5.56-2.el7.x86_64 解决依赖
rpm -e –nodeps mariadb-libs-1:5.5.56-2.el7.x86_64 - 再次执行第三步 安装server
- 安装客户端
rpm -ivhMySQL-client-5.6.25-1.el6.x86_64.rpm - 启动mysql
service mysql start - 初始化mysql
/usr/bin/mysql_secure_installation - 测试mysql
mysql -u root -p
注意事项
初始化mysql时可能出现问题
- 先关闭mysql
service mysql stop - 跳过检查
service mysql start –skip-grant-tables 进入mysql 设置密码
mysql> update mysql.user set password=PASSWORD('newpassword') where User='root'; mysql> flush privileges; mysql> quit
- 重启mysql
service mysql start - 连接
mysql -u root -p
备注
- 修改mysql密码
set password for root@localhost = password('123');