我使用以下命令 sudo apt-get install mysql-server 安装了 mysql,并且它安装正确。然后我通过参考此链接卸载了它
https://stackoverflow.com/questions/10853004/removing-mysql-5-5-completely
第一个答案,
然后尝试从他们的官方网站安装 5.0.96,下载 rpm,转换为 deb,然后安装,但失败了,我再次清除了所有内容,重新启动,并尝试使用相同的旧命令进行安装
sudo apt-get install mysql-server
但一切都会顺利进行到这个地方然后卡住我等了大约一个小时,
这是终端日志
mukund@mukund-ThinkPad-Edge-E431:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5
mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5
mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 8 newly installed, 0 to remove and 30 not upgraded.
Need to get 0 B/8,351 kB of archives.
After this operation, 94.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 235747 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.47-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.47-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package mysql-client-core-5.5.
Preparing to unpack .../mysql-client- core-5.5_5.5.47-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client- 5.5_5.5.47-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.5.
Preparing to unpack .../mysql-server-core-5.5_5.5.47-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up mysql-common (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 235938 files and directories currently installed.)
Preparing to unpack .../mysql-server- 5.5_5.5.47-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.47-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-server (5.5.47-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libmysqlclient18:amd64 (5.5.47-0ubuntu0.14.04.1) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up mysql-client-core-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.5 (5.5.47-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.5 (5.5.47-0ubuntu0.14.04.1) ...
160407 14:27:27 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
160407 14:27:27 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
160407 14:27:27 [Note] /usr/sbin/mysqld (mysqld 5.5.47-0ubuntu0.14.04.1-log) starting as process 2327 ...
并显示有关密码的错误消息,说用户已存在,我单击了确定,然后什么都没有......
请帮助我解决此事
这是 mysql/error.log
160408 15:05:46 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160408 15:05:46 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
160408 15:05:46 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160408 15:05:46 InnoDB: The InnoDB memory heap is disabled
160408 15:05:46 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160408 15:05:46 InnoDB: Compressed tables use zlib 1.2.8
160408 15:05:46 InnoDB: Using Linux native AIO
160408 15:05:46 InnoDB: Initializing buffer pool, size = 128.0M
160408 15:05:46 InnoDB: Completed initialization of buffer pool
160408 15:05:46 InnoDB: highest supported file format is Barracuda.
160408 15:05:46 InnoDB: Waiting for the background threads to start
160408 15:05:47 InnoDB: 5.5.47 started; log sequence number 1595675
160408 15:05:47 [ERROR] /usr/sbin/mysqld: unknown option '--skip-locking'
160408 15:05:47 [ERROR] Aborting
160408 15:05:47 InnoDB: Starting shutdown...
答案1
尝试:
sudo service mysql stop
然后:
sudo apt-get purge mysql-server
sudo apt-get autoremove
less /etc/passwd
检查底部是否有 mysql 用户。如果有:
sudo userdel mysql
完成所有操作后,尝试使用之前使用的命令再次安装 Mysql。
答案2
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
当mysql服务无法启动时,就会出现这个错误。
无需删除 mysql。
请按照以下步骤操作:$ sudo su
/etc/init.d/mysql启动