在arch linux下面安装mysql(mariadb)

在Arch Linux下面安装(本人使用manjaro-Linux):

在介绍怎么在 arch Linux下面安装mysql的时候,我首先要介绍另外一个数据库 : mariadb,在Archlinux下面mysql和maria可以算得上是同一个数据库,只不过名字不同,但是完全相互联通。

1.更新源: sudo pacman -Syu

MySQL

sudo pacman -S mysql


这个安装好了之后你会发现没有什么作用,所以我建议直接安装Mariadb


[yu@yu-Danger ~]$ sudo pacman -S mariadb [sudo] password for yu: warning: mariadb-10.1.31-1 is up to date -- reinstalling resolving dependencies... looking for conflicting packages...

Packages (1) mariadb-10.1.31-1

Total Installed Size: 172.12 MiB Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n] (1/1) checking keys in keyring [######################] 100% (1/1) checking package integrity [######################] 100% (1/1) loading package files [######################] 100% (1/1) checking for file conflicts [######################] 100% (1/1) checking available disk space [######################] 100% :: Processing package changes... (1/1) reinstalling mariadb [######################] 100% :: Running post-transaction hooks... (1/3) Updating system user accounts... (2/3) Creating temporary files... (3/3) Arming ConditionNeedsUpdate...


在此提醒,在这之前已经装过MySQL的朋友也不用担心什么卸载不干净的说法这不是Windows问题不大


装好了mariadb之后: 就您还可以在安装过程中设置 MySQL 根密码。

[yu@yu-Danger ~]$ sudo systemctl start mysqld && mysql_secure_installation


当最初提示 MySQL 根密码时, 您可以继续按回车键, 因为它还没有设置。 你的安装应该是这样的(按照提示完成判断y/n均为y):


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

Set root password? [Y/n] 12345678 Set root password? [Y/n] 12345678 Set root password? [Y/n] New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] ... Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] ... Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n]

  • Dropping test database... ... Success!
  • Removing privileges on test database... ... Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!


接下来, 重新启动 MySQL:

$ sudo systemctl restart mysqld


之后就可以按照正常进入mysql那样的进入到mariadb进入到mysql中了

mysql -u root -p


密码就是之前你在上面自己设置的密码,


Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.31-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>


现在你就已经成功进入到MySQL(MariaDB)中了。

猜你喜欢

转载自blog.csdn.net/qq_37788081/article/details/79457970