MariaDB數據庫 分為源代碼版本和二進制版本,源代碼版本需要cmake編譯,這里是二進制版本的安裝
# tar zxvf mariadb-5.5.31-linux-x86_64.tar.gz # mv mariadb-5.5.31-linux-x86_64 /usr/local/MySQL (必需這樣,很多腳本或可執行程序都會直接訪問這個目錄)# groupadd mysql 增加 mysql 屬組 # useradd -g mysql mysql 增加 mysql 用戶 并歸于mysql 屬組 # chown mysql:mysql -Rf /usr/local/mysql 設置 mysql 目錄的用戶及用戶組歸屬。 # chmod +x -Rf /usr/local/mysql 賜予可執行權限 # cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf 復制默認mysql配置 文件到/etc 目錄 # /usr/local/mysql/scripts/mysql_install_db --user=mysql 初始化數據 庫 # cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 復制mysql服務程序 到系統 目錄 # chkconfig mysql on 添加mysql 至系統服務并設置為開機啟動 # service mysql start 啟動mysql#vim /etc/profile 編輯profile,將mysql的可執行路徑加入系統PATHexport PATH=/usr/local/mysql/bin:$PATH #source /etc/profile 使PATH生效。#mysqladmin -u root password 'yourrootpassword' 設定root賬號及密碼#mysql -uroot -p 使用root用戶登錄mysql[none]>use mysql 切換至mysql數據庫。[mysql]>select user,host,password from user; --查看系統權限[mysql]>drop user ''@'localhost'; --刪除不安全的賬戶[mysql]>drop user root@'::1';[mysql]>drop user root@127.0.0.1;
[mysql]>select user,host,password from user; --再次查看系統權限,確保不安全的賬戶均被刪除。
[mysql]>flush privileges; --刷新權限
1)修改字符集為UTF8
#vi /etc/my.cnf
在[client]下面添加 default-character-set = utf8
在[mysqld]下面添加 character_set_server = utf8
修改完重啟:#service mysql restart
2)增加錯誤日志
#vi /etc/my.cnf
在[mysqld]下面添加:
log-error = /usr/local/mysql/log/error.loggeneral-log-file = /usr/local/mysql/log/mysql.log
修改完重啟:#service mysql restart
3) 設置為不區分大小寫,linux下默認會區分大小寫。
#vi /etc/my.cnf
在[mysqld]下面添加:
lower_case_table_name=1
修改完重啟:#service mysql restart
出現 FATAL ERROR: Could not find ./bin/my_print_defaults 解決方法
錯誤信息:
FATALERROR:Couldnotfind./bin/my_print_defaultsIf you are using a binary release, you must run this script fromwithin the directory the archive extracted into. If you compiledMySQL 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_defaultsIf you compiled from source, you need to run 'make install' tocopy the software into the correct location ready for operation.If you are using a binary release, you must either be at the toplevel of the extracted archive, or pass the --basedir optionpointing to that location.
解決方法:
[root@bogon scripts]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &(這點非常重要)
啟動mysql時報錯 mysqld_safe Logging to '/usr/local/mysql/data/zrf.err'.
以上所述是小編給大家介紹的Linux下安裝MariaDB數據庫問題及解決方法(二進制版本的安裝),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!
錯誤信息:
[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/data101021 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
問題應該出在這里!重新初始化下數據庫看下能否解決問題!
# /usr/local/mysql/bin/mysql_install_db --user=mysql
以上所述是小編給大家介紹的Linux下安裝MariaDB數據庫問題及解決方法(二進制版本的安裝),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!
新聞熱點
疑難解答