1:mysql安装和配置

1:安装mysql

 

sudo apt-get install mysql-server

 安装完成会自动启动mysql服务

 

2:安装中出现错误,删除安装的

sudo apt-get remove mysql-server

 重新安装

 

3:安装后不能用root用户登陆解决办法

 

1、打开/etc/mysql/debian.cnf文件,记录下文件中[client]节提供的用户名和密码: 
mysql -u debian-sys-maint -p 
Enter password: <输入[client]节的密码> 
mysql>use mysql;
mysql> UPDATE user SET Password=PASSWORD('newpwd') where User=’root’; 

mysql>grant all privileges on *.* to root@"localhost" identified by "123456789";

mysql>FLUSH PRIVILEGES // 权限立即生效

一定要授权
mysql>quit

 

2:重新启动

 

sudo /etc/init.d/mysql restart

 

猜你喜欢

转载自iluoxuan.iteye.com/blog/1937007