#安装mysql 教程
1.第一步
sudo apt install mysql-server
done!
update-alternatives: 使用 /var/lib/mecab/dic/ipadic-utf8 来在自动模式中提供 /var/lib/mecab/dic/debian (mecab-dictionary)
正在设置 mysql-server-8.0 (8.0.32-0ubuntu0.22.04.2) …
update-alternatives: 使用 /etc/mysql/mysql.cnf 来在自动模式中提供 /etc/mysql/my.cnf (my.cnf)
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 2954181
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
正在设置 mysql-server (8.0.32-0ubuntu0.22.04.2) …
正在处理用于 man-db (2.10.2-1) 的触发器 …
正在处理用于 libc-bin (2.35-0ubuntu3.1) 的触发器 …
2. 第二步
systemctl status mysql。启动mysql
第三步 设置开机自启
sudo update-rc.d -f mysql defaults
第四步 进入mysql
mysql
设置 用户
create user 'root'@'%' identified with mysql_native_password by 'zhijian_test';
设置远程访问
grant all privileges on *.* to 'root'@'%' with grant option;
进行指令刷新
flush privileges;
取消bind-address=127.0.0.1
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
重启服务
sudo service mysql restart