Linux 新手,所以请温柔一点。
尝试使用启动 mysql
mysql -u root -p
我收到以下错误:
错误 2002 (HY000):无法通过套接字“/var/run/mysqld/mysqld.sock”连接到本地 MySQL 服务器 (2)
在线解决方案建议我应该重新安装 mysql,所以我照做了,但现在我收到了以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies.
mysql-server : Depends: mysql-community-server (= 5.6.23-1ubuntu14.10) but it is not going to be installed
到目前为止还没有运气。如果这个问题很愚蠢,请原谅。我已经尝试了这里以及许多其他地方,但都无济于事。
干杯。
已安装软件包列表:
akonadi-backend-mysql deinstall
libmysqlcppconn7 deinstall
mysql-apt-config install
mysql-server-5.5 deinstall
mysql-workbench deinstall
没有错误日志,我认为当我尝试进行深度彻底删除时它被删除了。
答案1
尝试删除mysql-apt-config
(正在开发中并且可能无法正确解决依赖关系)并mysql-server
从官方存储库重新安装:
sudo apt-get purge mysql-apt-config && sudo apt-get install mysql-server
答案2
sudo apt-get purge mysql-apt-config && sudo apt-get install mysql-server
现在删除那些为了满足某些包的依赖关系而自动安装的不再需要的包。
sudo apt-get autoremove -y
现在重新安装 MySQL
安装 Mysql 5.7
安装 Mysql
sudo apt-get update
sudo apt-get install mysql-server=5.7.22-0ubuntu0.16.04.1
mysql_secure_installation
检查Mysql进程是否正在运行
sudo service mysql status
设置启用远程访问(使用 Vim、nano、您喜欢的文本编辑器...)
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
编辑配置
bind-address = 127.0.0.1 --> bind-address = 0.0.0.0
给用户添加权限
也授予 root 权限
grant all privileges on *.* to root@'%' identified by <PASSWORD>;
flush privileges;