vim my.cnf
[mysqld]
basedir=/usr/local/mysql8
datadir=/usr/local/mysql8/data
user = mysql
#log-bin=/usr/local/mysql8/mysql-bin
#binlog-ignore-db=mysql
#default_authentication_plugin=caching_sha2_password
character-set-server=utf8
collation-server=utf8_general_ci
max_connections=4096
max_connect_errors = 1024
socket=/usr/local/mysql8/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/usr/local/mysql8/mysqld.log
pid-file=/usr/local/mysql8/mysqld.pid
#server-id=10011
#relay-log=relay-log.log
#binlog_format=ROW
#gtid_mode=on
#enforce_gtid_consistency=ON
#master_info_repository=TABLE
#relay_log_info_repository=TABLE
#sync_master_info=1
#slave_parallel_workers=2
#binlog_checksum=CRC32
#master_verify_checksum=1
#slave_sql_verify_checksum=1
#binlog_rows_query_log_events=1
#log_bin=mysql-bin.log
#replicate_do_db=tt
#slave_parallel_type=logical_clock
#skip-grant-tables
mysql安装
groupadd mysql
useradd -r -g mysql mysql
vi /etc/profile
source /etc/profile
cd ..
ll
chown -R mysql:mysql /usr/local/mysql8
cd mysql8/
cd bin/
ll
./mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql
ll
cd ..
ll
cat mysqld.log
cd /usr/local/mysql8/support-files
ll
cp /usr/local/mysql8/support-files/mysql.server /etc/init.d/mysqld
service mysqld start
ll
cd /usr/local/mysql8/
ll
ln -s /usr/local/mysql8/mysql.sock /tmp/mysql.sock
cd bin/
mysql初始化密码
mysql> alter user 'root'@'%' identified by "ADmin.001";
Query OK, 0 rows affected (0.02 sec)
mysql> update mysql.user set host='%' where user = 'root';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
mysql密码重置
mysql> update user set authentication_string='' where user='root';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> alter user 'root'@'%' identified by "ADmin.001";
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
mysql8部署
最新推荐文章于 2024-07-04 16:40:09 发布