ubuntu mysql安装和修改密码
sudo apt-get install mysql-server sudo apt-get install mysql-client sudo apt-get install libmysqlclient-dev
文件:/etc/mysql/debian.cnf 记录创建数据库时初始账户,可用此登录
error: 'Access denied for user 'root'@'localhost' (using password: YES)'解决办法:
/etc/init.d/mysql stop #停止mysql or service mysql stop su root mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
#此步骤报错:mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file don’t exists
mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld mysqld_safe --user=mysql --skip-grant-tables --skip-networking & mysql -u root mysql #进入mysql交互模式 update user set authentication_string=PASSWORD("your_psswrd") where user='root'; #mysql的密码都存储在mysql库的user表里,直接更新用户表 update user set plugin="mysql_native_password"; flush privileges; #更新权限 quit; mysql -u root -p #重新登录
在apt安装软件时,出现了hash校验和不符的问题,热点网换成学校网好了,貌似是运营商问题?
https://forum.ubuntu.com.cn/viewtopic.php?f=77&t=465499&hilit=Hash
启动mysql又遇到问题:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.