1. 程式人生 > >mysql安裝報錯error while loading shared libraries: libaio.so.1: cannot open shared object file: No such

mysql安裝報錯error while loading shared libraries: libaio.so.1: cannot open shared object file: No such

使用ubantu安裝mysql時,出現報錯

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# ./scripts/mysql_install_db --user=mysql --datadir=/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64/mysqldata/mysql
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

原因是未安裝libaio,負責非同步IO。

安裝libaio1

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# sudo apt-get install libaio1
正在讀取軟體包列表... 完成
正在分析軟體包的依賴關係樹       
正在讀取狀態資訊... 完成       
您可能需要執行“apt-get -f install”來糾正下列錯誤:
下列軟體包有未滿足的依賴關係:
 mysql-community-server : 依賴: mysql-common (>= 5.6.40-1ubuntu14.04) 但是它將不會被安裝
                          依賴: mysql-client (= 5.6.40-1ubuntu14.04) 但是它將不會被安裝
E: 有未能滿足的依賴關係。請嘗試不指明軟體包的名字來執行“apt-get -f install”(也可以指定一個解決辦法)。

發現有未滿足的依賴關係

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# apt-get -f install
正在讀取軟體包列表... 完成
正在分析軟體包的依賴關係樹       
正在讀取狀態資訊... 完成       
正在更正依賴關係... 完成
將會安裝下列額外的軟體包:
  libaio1 libevent-core-2.0-5 liblz4-1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7

安裝完畢後啟動mysqld

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# ./scripts/mysql_install_db --user=mysql --datadir=/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64/mysqldata/mysql
Installing MySQL system tables...2018-10-16 16:03:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-16 16:03:25 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-10-16 16:03:25 0 [Note] ./bin/mysqld (mysqld 5.6.41) starting as process 35054 ...
OK

可以發現程序中mysqld已經啟動成功

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# ps -ef | grep mysql
mysql     34965      1  1 16:03 ?        00:00:00 /usr/sbin/mysqld
root      35133  30721  0 16:03 pts/19   00:00:00 grep --color=auto mysql

進入mysql

[email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.23-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql安裝成功。