MariaDB(MYSQL)踩坑記!!!
centos 7 解除安裝 mariadb 的正確命令
#列出所有被安裝的rpm package
rpm -qa | grep MariaDB
#解除安裝
rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64
錯誤:依賴檢測失敗:
libmysqlclient.so.18()(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
libmysqlclient.so.18(libmysqlclient_18)(64bit) 被 (已安裝) postfix-2:2.10.1-6.el7.x86_64 需要
#強制解除安裝,因為沒有--nodeps
rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64
////////////////////////////////////////////////////////////////////////////
MariaDB 啟動錯誤
Job for mariadb.service failed because the control process exited with error code. See "systemctl status
mariadb.service" and "journalctl -xe" for details
Dec 12 20:56:53 localhost.localdomain systemd[1]: Starting MariaDB 10.3.4 database server...
Dec 12 20:56:53 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=217
Dec 12 20:56:53 localhost.localdomain systemd[1]: Failed to start MariaDB 10.3.4 database server.
Dec 12 20:56:53 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Dec 12 20:56:53 localhost.localdomain systemd[1]: mariadb.service failed.
解決辦法:
解除安裝,重新安裝:yum -y install mariadb-server yum -y install mariadb-devel
參考 https://www.cnblogs.com/shanyou/p/3278692.html
-----------------------------------------------------
MariaDB 啟動錯誤
/usr/sbin/mysqld: unknown variable 'default-character-set=utf8mb4'
Failed to start MariaDB 10.3.4 database server.
參考:https://www.cnblogs.com/felove2013/p/6293710.html
vim /etc/my.cnf.d/server.cnf
[mysqld] 處 新增
character_set_server=utf8
--------------------C++連結錯誤-----------------------------------------------------
Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/)
http://blog.itpub.net/30150152/viewspace-1800526
-------------------------------------------------------------------------
Navicat for MySQL連結出現錯誤:
115 - Unknown character set :'utf8'
Navicat for MySQL客戶端:連線屬性--》高階--》編碼--》UTF8
-------------------------------------------------------------------------
mysql:1130 is not allowed to connect to this MariaDB server(沒有遠端登入許可權,注:這裡的MariaDB 是MySQL的延伸版)
解決:use mysql; update user set Host='%' where Host='localhost'; flush privileges;
-------------------------------------------------------------------------
-----MySQL初始無密碼登入,並修改密碼
vim /etc/my.cnf.d/server.cnf
[mysqld] ##此處新增
skip-grant-tables ##此處新增
改完密碼載次註解
https://www.cnblogs.com/gumuzi/p/5711495.html
------------------------------------------------------------------------------
/usr/bin/ld: cannot find -lmysqlclient_r,原因是/usr/lib64/mysql找不到libmysqlclient_r.so
解決辦法:(參考)
首先你需要找到這個庫的位置
一般找的話需要將lib 給加上(注意:我這裡是 -lmysqlclient_r 的報錯,於是我找就找 libmysqlclient_r )
find / -name libmysqlclient_r*
/usr/lib64/mysql/libmysqlclient_r.so
/usr/lib64/mysql/libmysqlclient_r.so.16
/usr/lib64/mysql/libmysqlclient_r.so.16.0.0
既然找到了 那應該是路徑的問題 以及庫檔名字的問題,於是做了如下的軟連線
ln -sv /usr/lib64/libmysqlclient_r.so.16.0.0 /usr/lib64/mysql/libmysqlclient_r.so(db_proxy_server/CMakeLists.txt設定的路徑:/usr/lib64/mysql)
名字也改了一下,然後再編譯就沒問題了
一般都是這樣的套路
--------------------------------------------------------------------------------