linux下安装mysql
1.下载rpm文件,一般开发只需要这三种
2.执行命令 rpm -ivh mysql* --nodeps --force
3.启动 service mysql start
4.设置跳过密码验证
vim /etc/my.cnf 在[mysqld]下 增加 skip-grant-tables
5.重启服务 service mysql restart
6.进入mysql mysql
7.
输入命令:mysql然后回车
输入命令:UPDATE mysql.user SET authentication_string = password('root') WHERE `User` = 'root';
输入命令:UPDATE mysql.user SET password_expired= 'N' WHERE `User` = 'root';
输入命令:flush privileges;
输入命令:exit;
8、删除 skip-grant-tables
9.重启mysql
5.重启服务 service mysql restart
6.进入mysql mysql
7.
输入命令:mysql然后回车
输入命令:UPDATE mysql.user SET authentication_string = password('root') WHERE `User` = 'root';
输入命令:UPDATE mysql.user SET password_expired= 'N' WHERE `User` = 'root';
输入命令:flush privileges;
输入命令:exit;
8、删除 skip-grant-tables
9.重启mysql
备注
需要外部连到mysql,需要更改
进入MySQL
>show databases;
>use mysql;
>select 'host' from user where user ='root';
>update user set host = '%' where user ='root';
>flush privileges;
>select 'host' from user where user ='root';
>exit;