mysql安装教程

mysql安装教程,第1张

mysql安装教程如下:

工具:windows10、电脑。

1、进入程序的安装界面,阅读软件使用条款,勾选同意软件使用协议,点击“Next”下一步。

2、点击第一项“开发人员默认”的安装类型,可以根据实际情况选择适合自己的安装类型,点击“Next”。

3、系统自动下载一些相关程序进行升级,直到所有安装完成,“Status”状态显示为“Complete”,点击“Next”。

4、进行每个安装产品的配置向导,点击“Next”开始配置,随时可以点击“Cancel”取消配置退出向导。

5、选择配置类型为开发,勾选“TCP/IP”选项,填写端口号,勾选打开防火墙端口以便可以连接网络。

6、填写管理员用户“root”登录密码,如需要添加额外用户,点击下方“AddUser”按钮添加用户,点击“Next”下一步。

7、勾选“将mysql服务设置为系统服务”并填写服务名称,勾选“在系统启动时同时启动mysql服务”,勾选下方“标准系统账户”,点击“下一步”。

8、等待所有安装项目进行完成,界面下方出现安装成功的提示信息,点击“Finish”退出向导,完成安装。

MySql安装

yum -y install libaio

wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

cd /usr/local/soft/mysql/src

mkdir ../5.7.24_3306 &&tar -xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C ../5.7.24_3306 --strip-components 1

mkdir -p /usr/local/soft/mysql/5.7.24_3306/{run,data,logs,bin_log,sock,cert}

groupadd mysql &&useradd -r -g mysql -s /bin/false mysql

cd /usr/local/soft/mysql/5.7.24_3306/bin &&./mysqld --initialize

--explicit_defaults_for_timestamp

--user=mysql

--basedir=/usr/local/soft/mysql/5.7.24_3306

--datadir=/usr/local/soft/mysql/5.7.24_3306/data

--lc_messages_dir=/usr/local/soft/mysql/5.7.24_3306/share

--lc_messages=en_US

2018-12-01T09:56:45.934627Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-12-01T09:56:46.056837Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-12-01T09:56:46.127141Z 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: 69d028f9-f54f-11e8-9c4a-00163e08e793.

2018-12-01T09:56:46.130249Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2018-12-01T09:56:46.131377Z 1 [Note] A temporary password is generated for root@localhost: sDdPx3>.,oBi

cd /usr/local/soft/mysql/5.7.24_3306/bin &&./mysql_ssl_rsa_setup --datadir=/usr/local/soft/mysql/5.7.24_3306/cert

修改证书权限为644

cd /usr/local/soft/mysql/5.7.24_3306/bin &&./mysql -uroot -S /usr/local/soft/mysql/5.7.24_3306/sock/mysql.sock

use mysql

update user set host = '%', authentication_string = password('123456') where user = 'root'

select host,user,authentication_string from user

flush privileges

grant all privileges on . to 'root'@'%'

flush privileges

cat >/etc/systemd/system/3306.service <<EOF

[Unit]

Description=MySQL 3306

Documentation= http://dev.mysql.com/doc/refman/en/using-systemd.html

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

PIDFile=/usr/local/soft/mysql/5.7.24_3306/run/mysql.pid

ExecStart=/usr/local/soft/mysql/5.7.24_3306/support-files/mysql.server start

ExecReload=/usr/local/soft/mysql/5.7.24_3306/support-files/mysql.server restart

ExecStop=/usr/local/soft/mysql/5.7.24_3306/support-files/mysql.server stop

PrivateTmp=true

[Install]

WantedBy=multi-user.target

EOF

systemctl enable 3306.service

1、

cd /usr/local/soft/mysql/5.7.24.3306/bin &&./mysqld_safe --skip-grant-tables &

cd /usr/local/soft/mysql/5.7.24.3306/bin &&./mysqld_safe --skip-grant-tables --skip-networking &

2、

./mysql -uroot -p -S /usr/local/soft/mysql/5.7.24.3306/sock/mysql.sock

3、

use mysql

update mysql.user set authentication_string=password('123456') where user='root'

flush privileges

mkdir -p /usr/local/soft/mysql/back/5.7.23_3306 &&cp -Rf /usr/local/soft/mysql/5.7.23_3306/* /usr/local/soft/mysql/back/5.7.23_3306

mkdir -p /usr/local/soft/mysql/back/5.7.24_3306 &&cp -Rf /usr/local/soft/mysql/5.7.24_3306/* /usr/local/soft/mysql/back/5.7.24_3306

CREATE USER 'sdyc'@'%' IDENTIFIED BY '123456'

GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON sd_data.* TO 'sdyc'@'%'

GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON card_data.* TO 'sdyc'@'%'

SHOW GRANTS FOR sdyc

CREATE USER 'back'@'localhost' IDENTIFIED BY '123456'

GRANT SELECT, RELOAD, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES, REPLICATION CLIENT ON . TO 'back'@'localhost'

SHOW GRANTS FOR back

REVOKE SELECT, INSERT, UPDATE, DELETE, EXECUTE ON sd_data.* FROM 'sdyc'@'%'

方法/步骤

1、下载安装文件,安装:双击Setup.exe文件,开始mysql的安装。

2、点击Next开始下一步安装。默认是Typical,选择Custom,因为Typical模式不允许改变安装路径,只能安装在C盘

3、这里需要选择组件和更改文件夹位置,组件可以默认的,位置要选择Change来改变(注意:安装mysql的路径中,不能含有中文)

4、点击Install开始安装

5、安装完成。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7376671.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存