Manjaro 下通过 pacman 安装 MySQL8

装了一天的 MySQL,docker 装和手动装都没成功,哈哈

记录下来,希望大家别遇到错误

环境:5.15.6-2-MANJARO

安装之前

使用 whereis mysql ,将所有目录都删除!(这个步骤很重要!)

安装

sudo pacman -S mysql

# install
sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql

# start
sudo systemctl start mysqld.service

# auto start on boot
sudo systemctl enable mysqld.service

截个图,有报错的铁子大多都失败了,请 1.卸载 + 2.删目录 进行重装
在这里插入图片描述
从截图最后一行最后可以看出:

2021-12-14T16:17:25.920008Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: y+1dd#5#AK;w

帐号 root、密码 y+1dd#5#AK;w

密码不好记忆,修改一下:

# 这里不加 sudo 就可使用
mysql_secure_installation

然后就是英语阅读理解啦!


Securing the MySQL server deployment.

# 1. 输入原密码
Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

# 2.设置新密码
New password: 

Re-enter new password: 

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

# 3. 是否使用安全组件。我填 no
Press y|Y for Yes, any other key for No: no
Using existing password for root.

# 4. 是否修改密码,我填 y,貌似多余了?
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: 

Re-enter new password: 
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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.

# 5. 是否移除匿名登录用户。我填是
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Success.


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

# 6. 是否不允许非本机登录。我填否,就是允许远程登录
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : No

 ... skipping.
By default, MySQL 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.

# 7. 是否移除 test 数据库,我填是,因为没啥用~
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
 - 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.

# 8.是否现在加载授权表(登录信息表),选是就可以用新密码了。?
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Success.

All done!

这里的英语相对简单,一步一步跟着走就不是太难

测试

mysql -uroot -p

查看安装位置

使用 whereis mysql 查看

1、配置文件 /etc/mysql/my.cnf
在这里插入图片描述
由其中的配置 datadir=/var/lib/mysql 可知他的数据文件存放位置为 var/lib/mysql

2、数据库文件 /var/lib/mysql

数据表存放形式:{数据库}/{数据表}.ibd

3、可执行文件 /usr/bin/mysql*

在这里插入图片描述

其他目录…

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值