zoukankan      html  css  js  c++  java
  • 在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
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    为什么要有红黑树?什么是红黑树?画了20张图,看完这篇你就明白了
    都2020年了,听说你还不会归并排序?手把手教你手写归并排序算法
    为什么会有多线程?什么是线程安全?如何保证线程安全?(带详细例子)
    微信小程序APP(商超营销类)经验总结
    CheckBox的OnCheckedChangeListener事件
    Android常用的工具类
    【原创】【Android】揭秘 ART 细节 ---- Garbage collection
    18级软件工程1班第一次作业总结
    HUST软工1506班第2周作业成绩公布
    HUST软件测试1506班: 第0周作业成绩
  • 原文地址:https://www.cnblogs.com/littlesuns/p/10942368.html
Copyright © 2011-2022 走看看