Linux下安装MySQL步骤

时间:2021-12-03 10:26:32

1.下载安装包(这里是32位的):

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

MySQL-server-5.6.13-1.rhel5.i386.rpm

2.安装

rpm -ivh MySQL-server-5.6.-.rhel5.i386

rpm -ivh MySQL-client-5.6.-.rhel5.i386

3.重启

4.netstate -ntl 查看3306端口是否启动,启动则正常。

5.

mysqladmin -u root password '';

mysql -u root -p
123456

如果进入,即出现mysql>表示安装登陆成功!

但是我第五步总会出错,错误信息是

ERROR  (): Access denied for user 'root'@'localhost' (using password: NO)

解决办法是:

 /etc/init.d/mysql stop

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit /etc/init.d/mysql restart mysql -u root -p
newpassword