Linux下安裝MariaDB數(shù)據(jù)庫(kù)問(wèn)題及解決方法(二進(jìn)制版本的安裝)
MariaDB數(shù)據(jù)庫(kù) 分為源代碼版本和二進(jìn)制版本,源代碼版本需要cmake編譯,這里是二進(jìn)制版本的安裝
# tar zxvf mariadb-5.5.31-linux-x86_64.tar.gz # mv mariadb-5.5.31-linux-x86_64 /usr/local/MySQL (必需這樣,很多腳本或可執(zhí)行程序都會(huì)直接訪問(wèn)這個(gè)目錄) # groupadd mysql 增加 mysql 屬組 # useradd -g mysql mysql 增加 mysql 用戶 并歸于mysql 屬組 # chown mysql:mysql -Rf /usr/local/mysql 設(shè)置 mysql 目錄的用戶及用戶組歸屬。 # chmod +x -Rf /usr/local/mysql 賜予可執(zhí)行權(quán)限 # cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf 復(fù)制默認(rèn)mysql配置 文件到/etc 目錄 # /usr/local/mysql/scripts/mysql_install_db --user=mysql 初始化數(shù)據(jù) 庫(kù) # cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 復(fù)制mysql服務(wù)程序 到系統(tǒng) 目錄 # chkconfig mysql on 添加mysql 至系統(tǒng)服務(wù)并設(shè)置為開(kāi)機(jī)啟動(dòng) # service mysql start 啟動(dòng)mysql #vim /etc/profile 編輯profile,將mysql的可執(zhí)行路徑加入系統(tǒng)PATH export PATH=/usr/local/mysql/bin:$PATH #source /etc/profile 使PATH生效。 #mysqladmin -u root password 'yourrootpassword' 設(shè)定root賬號(hào)及密碼 #mysql -uroot -p 使用root用戶登錄mysql [none]>use mysql 切換至mysql數(shù)據(jù)庫(kù)。 [mysql]>select user,host,password from user; --查看系統(tǒng)權(quán)限 [mysql]>drop user ''@'localhost'; --刪除不安全的賬戶 [mysql]>drop user root@'::1'; [mysql]>drop user root@127.0.0.1;
[mysql]>select user,host,password from user; --再次查看系統(tǒng)權(quán)限,確保不安全的賬戶均被刪除。
[mysql]>flush privileges; --刷新權(quán)限
1)修改字符集為UTF8
#vi /etc/my.cnf
在[client]下面添加 default-character-set = utf8
在[mysqld]下面添加 character_set_server = utf8
修改完重啟:#service mysql restart
2)增加錯(cuò)誤日志
#vi /etc/my.cnf
在[mysqld]下面添加:
log-error = /usr/local/mysql/log/error.log general-log-file = /usr/local/mysql/log/mysql.log
修改完重啟:#service mysql restart
3) 設(shè)置為不區(qū)分大小寫(xiě),linux下默認(rèn)會(huì)區(qū)分大小寫(xiě)。
#vi /etc/my.cnf
在[mysqld]下面添加:
lower_case_table_name=1
修改完重啟:#service mysql restart
出現(xiàn) FATAL ERROR: Could not find ./bin/my_print_defaults 解決方法
錯(cuò)誤信息:
FATALERROR:Couldnotfind./bin/my_print_defaults If you are using a binary release, you must run this script from within the directory the archive extracted into. If you compiled MySQL yourself you must run 'make install' first.
或
[root@bogon scripts]# /usr/local/mysql/scripts/mysql_install_db --user=mysql& [1] 16874 [root@bogon scripts]# FATAL ERROR: Could not find ./bin/my_print_defaults If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for operation. If you are using a binary release, you must either be at the top level of the extracted archive, or pass the --basedir option pointing to that location.
解決方法:
[root@bogon scripts]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &(這點(diǎn)非常重要)
啟動(dòng)mysql時(shí)報(bào)錯(cuò) mysqld_safe Logging to '/usr/local/mysql/data/zrf.err'.
以上所述是小編給大家介紹的Linux下安裝MariaDB數(shù)據(jù)庫(kù)問(wèn)題及解決方法(二進(jìn)制版本的安裝),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
錯(cuò)誤信息:
[root@zrf ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql& [1] 3527 [root@zrf ~]# 101021 16:37:39 mysqld_safe Logging to '/usr/local/mysql/data/zrf.err'. 101021 16:37:39 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 101021 16:37:39 mysqld_safe mysqld from pid file /usr/local/mysql/data/zrf.pid ended
解決辦法:
/usr/local/mysql/libexec/mysqld: Table 'mysql.plugin' doesn't exist
問(wèn)題應(yīng)該出在這里!重新初始化下數(shù)據(jù)庫(kù)看下能否解決問(wèn)題!
# /usr/local/mysql/bin/mysql_install_db --user=mysql
以上所述是小編給大家介紹的Linux下安裝MariaDB數(shù)據(jù)庫(kù)問(wèn)題及解決方法(二進(jìn)制版本的安裝),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
Ubuntu修改密碼及密碼復(fù)雜度策略設(shè)置方法
這篇文章主要介紹了Ubuntu修改密碼及密碼復(fù)雜度策略設(shè)置,方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-08-08Linux下如何實(shí)時(shí)查看GPU狀態(tài)
這篇文章主要介紹了Linux下如何實(shí)時(shí)查看GPU狀態(tài)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-05-05Ubuntu 16.04 LTS系統(tǒng)里中文txt文件打開(kāi)的問(wèn)題解決
這篇文章主要給大家介紹了關(guān)于Ubuntu 16.04 LTS系統(tǒng)里中文txt文件打開(kāi)問(wèn)題的解決方法,文中通過(guò)示例代碼將解決的方法介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2018-04-04Linux centos7 下安裝 phpMyAdmin的教程
這篇文章主要介紹了Linux centos7 安裝 phpMyAdmin的教程,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-01-01詳解linux下redis安裝、啟動(dòng)與停止,redis做成服務(wù)
這篇文章主要介紹了詳解linux下redis安裝、啟動(dòng)與停止,redis做成服務(wù),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2016-12-12Linux中設(shè)置路由以及虛擬機(jī)聯(lián)網(wǎng)圖文詳解
這篇文章主要介紹了Linux中設(shè)置路由以及虛擬機(jī)聯(lián)網(wǎng),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04