Welcome

首页 / 操作系统 / Linux / Debian中安装MySQL8.0.2的实现过程

Debian中安装MySQL8.0.2的实现过程

//查询包是否存在

find / -name libncurses.so.5

//安装

apt install ncurses libncurses-dev libncurses5

//映射

ln -s /lib/libncurses.so.5 /usr/lib/libtinfo.so.5

apt install libaio-dev libnuma-dev

添加用户组和用户

groupadd mysql

useradd -r -g mysql mysql

#赋予权限

chown mysql:mysql -R /usr/local/mysql   


编辑配置文件vi /etc/my.cnf

[mysqld]

bind-address=0.0.0.0

port=3306

user=mysql

basedir=/usr/local/mysql

datadir=/home/data

socket=/tmp/mysql.sock

log-error=/home/data/mysql.err

pid-file=/home/data/mysql.pid

#character config

character_set_server=utf8mb4

symbolic-links=0

explicit_defaults_for_timestamp=true

innodb_log_file_size = 512M

max_allowed_packet = 200M


先初始化

./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/home/data --user=mysql --initialize --console

进入到./support-files下

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

启动服务

service mysql start

systemctl start mysql

systemctl status mysql

grant all privileges on *.* to root@'%' identified by 'root';


mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';

mysql> grant all on *.* to 'root'@'%';

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

mysql> FLUSH PRIVILEGES;  # 刷新