在ArchLinux、manjaro中安裝MySql(mariaDB)


      安裝MySql數據庫。但是在MySql被Oracle收購之后,很多開源支持者就轉而使用MariaDb了。不過MariaDb也和MySql兼容的,所以基本不用有什么擔心。由於ArchLinux只帶了MariaDb,所以我們就用MariaDb來代替MySql。

安裝MariaDb和其客戶端工具,

sudo pacman -S mariadb mariadb-clients


安裝完成之后,會出現如何開啟MariaDb的提示:

:: You need to initialize the MariaDB data directory prior to starting
the service. This can be done with mysql_install_db command, e.g.:
mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql

根據提示,我們運行如下命令就可以初始化MariaDb的數據目錄了。

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

在經過一長串提示信息之后,就會出現相應的如何開啟MariaDb的幫助信息:

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h mypc password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at sales@mariadb.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

同樣根據提示,我們首先需要先啟動MariaDb,

sudo systemctl start mysqld

然后為root用戶設置一個新密碼,

mysqladmin -u root password '12345678'

然后嘗試登錄MariaDb,如果登錄成功,說明配置完成了,

mysql -uroot -p12345678

如果想要MariaDb開機自動啟動,那么就運行以下命令,

sudo systemctl enable mysqld
---------------------
作者:過了即是客
來源:CSDN
原文:https://blog.csdn.net/u011054333/article/details/53203787
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM