mysql怎么指令安装 mysql安装指南

MySQL安装命令

MySql安装

成都创新互联是一家专业的成都网站建设公司,我们专注成都做网站、网站设计、网络营销、企业网站建设,卖链接一元广告为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。

yum -y install libaio

wget

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=

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'@'%';

命令行怎么安装mysql数据库

一 Mysql命令行连接

一般对于刚刚安装好的mysql,如果勾选启用mysql lineclient的话。可以直接通过找到开始---程序--- mysql command line client如下图

点击mysql命令行之后,会提示你输入root密码。输入正确的root密码之后即可连接到msyql数据库里啦

二 Cmd命令行怎么连接数据库

如果没有安装mysql命令行的话,我们可以通过找到 mysqld所在的路径(复制mysqld.exe所在路径)

使用cd切换到msyqld.exe路径下,然后输入mysql连接命令如下图

格式是:

Mysql -P 端口号 -h mysql主机名\ip -u root (用户) -p

如果是命令行是mysql所在的本机

而且用默认的端口 3306 直接输入 mysql -u root -p 即可

第三方mysql数据库连接工具

通过第三方数据库连接工具这些就很多啦,如下图设置好相关参数即可

连接进去之后,也就是比较人性化的图形界面了。

更多关于mysql数据库工具navicat for mysql怎么用?

8

其他远程连接工具

Phpmyadmin 无疑是使用最广泛的php管理数据库的图形化工具了,由于涉及到不同的环境和路径。本例咗嚛不做详细操作

windows怎样命令行安装mysql数据库

使用命令行创建MySql数据库,首先要登录MySql数据库系统

创建步骤如下:

Windows操作系统下,开始——运行,打开"运行"对话框,输入cmd,点击“确定”即可进入DOS窗口,输入登录MySQL数据库命令

mysql -h 127.0.0.1 -u root -p

参数含义:

mysql是登录数据库的命令,-h 后面跟服务器的IP,由于本示例MySql服务器安装在本地,因此IP地址为127.0.0.1;-u 后面跟用户名,本示例采用 root用户登录;-p 后面跟登录密码。

输入上述命令后回车,再输入登录密码,一般默认密码是root

回车

成功登录MySQL数据库后就可以在DOS下使用SQL语句"create database"创建数据库了

mysqlcreate database 要创建的新数据库名;


网站栏目:mysql怎么指令安装 mysql安装指南
文章位置:http://scyanting.com/article/dosiicc.html