2019-10-24T08:47:21.549556Z 0 [System] [MY-013169] [Server] D:\Develop\mysql-8.0 .18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 7612 2019-10-24T08:47:34.895556Z 5 [Note] [MY-010454] [Server] A temporary password i s generated for root@localhost: 6#gL3pJ#qyh.
# 安装rpm源 sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm # 编辑,找到Enable to use MySQL 5.7,改为enabled=1,其他版本设置成enabled=0, # 同理这个方法可以按照别的版本 vim /etc/yum.repos.d/mysql-community.repo # 检查只有MySQL 5.7启动 yum repolist enabled | grep mysql # 安装MySQL sudo yum install mysql-community-server # 启动MySQL服务器 sudo service mysqld start # MySQL服务器的状态 sudo service mysqld status # 查看超级用户的密码 sudo grep 'temporary password' /var/log/mysqld.log # 登录mysql mysql -uroot -p # 修改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; # 默认mysql的root用户不支持远程访问,开启访问权限 GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; flush privileges; # 修改密码设置级别 set global validate_password_policy=0; set global validate_password_length=1; # 开启3306端口 firewall-cmd --add-port=3306/tcp # (a)数据库目录 /var/lib/mysql/ # (b)配置文件 /usr/share /mysql(mysql.server命令及配置文件) /etc/my.cnf # (c)相关命令 /usr/bin(mysqladmin mysqldump等命令) # (d)启动脚本 /etc/rc.d/init.d/(启动脚本文件mysql的目录)
cd /usr/local/mysql mkdir data chmod 750 data chown mysql:mysql data
初始化
参数: –initialize 会生成一个随机密码
1
bin/mysqld --initialize --user=mysql
显示下面则初始化成功:
1 2 3 4 5 6 7 8
[root@bogon mysql]# bin/mysqld --initialize --user=mysql 2019-10-23T07:41:12.611481Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-10-23T07:43:00.499738Z 0 [Warning] InnoDB: New log files created, LSN=45790 2019-10-23T07:43:00.819667Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-10-23T07:43:00.919776Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: bd1531fb-f568-11e9-bc4b-46afd4d32e02. 2019-10-23T07:43:00.958124Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2019-10-23T07:43:02.482380Z 0 [Warning] CA certificate ca.pem is self signed. 2019-10-23T07:43:02.643686Z 1 [Note] A temporary password is generated for root@localhost: Wsi!(otie8de
命令添加到环境变量中
1 2 3 4 5
vim /etc/profile # 添加 PATH=$PATH:/usr/local/mysql/bin # 使生效 source /etc/profile