sudo groupadd mysql
sudo useradd -g mysql mysql -s/sbin/nologin
cd /usr/local/mysql
sudo mkdir data
sudo chown -R mysql:mysql .
sudo cp support-files/mysql.server /etc/init.d/
sudo bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
# 记下安装过程中的临时密码,后边用于修改 root 密码(yq7A*IhE5kl0)
sudo vi /etc/my.cnf
# 输入以下内容
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /tmp/mysql.sock
bind-address=0.0.0.0
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
sudo service mysql start
# 输入安装时生成的临时密码进行登录
mysql -uroot -p
# 修改密码
ALTER USER 'root'@'localhost' identified BY '123456';
页面更新:2024-04-06
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号