ubuntu安装mysql
Posted KevinEngineer
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu安装mysql相关的知识,希望对你有一定的参考价值。
安装mysql
1.sudo apt-get install mysql-client mysql-server
启动
2.service mysqld start
登陆
3.mysql -uroot
报错Access denied for user ‘root‘@‘localhost‘
先关闭mysql
4.service mysqld stop
安全启动MySQL(跳过密码验证)
5./usr/bin/mysqld_safe --skip-grant-tables
又报错mysqld_safe Directory ‘/var/run/mysqld‘ for UNIX socket file don‘t exists
解决方法
6.mkdir -p /var/run/mysqld
7.chown mysql:mysql /var/run/mysqld
重新安全启动
8./usr/bin/mysqld_safe --skip-grant-tables
打开另一个终端,登陆mysql
9.mysql -uroot
修改密码
10.grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘123465‘ with grant option;
报错ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
修改读写权限
11.set global read_only=0;
flush privileges;
再次修改密码,报错Plugin ‘auth_socket‘ is not loaded
修改user表
12.update user set plugin="mysql_native_password";
flush privileges;
再次修改密码
13.grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘123465‘ with grant option;
flush privileges;
修改成功
以上是关于ubuntu安装mysql的主要内容,如果未能解决你的问题,请参考以下文章