好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

mysql安装

先下载mysql安装包

https://downloads.mysql测试数据/archives/community/

选择第一个比较小的安装包下载即可

解压

在解压后的根目录,新建data目录和my.ini文件

data目录:存放数据

my.ini:mysql的设置信息

设置my.ini文件内容

  [mysqld ]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir =d :\ \mysql\ \mysql - 8.0.19 -winx64
#设置mysql数据库的数据的存放目录
datadir =d :\ \mysql\ \mysql - 8.0.19 -winx64\ \data
# 允许最大连接数
max_connections = 200
# 允许连接失败的次数,这是为了防止有人从该主机试图工具数据库系统
max_connect_errors = 10
# 服务端使用的字符集默认为UTF-8
character - set - server =utf8
# 创建新表时将使用的默认存储引擎
default - storage - engine = INNODB
?
[mysql ]
# 设置mysql客户端默认字符集
default - character - set =utf8
?
[client ]
# 设置mysql客户端连接服务器时默认使用的端口
port = 3306
default - character - set =utf8

设置环境变量

MYSQL_HOME

mysql安装路径

D:\mysql\mysql-8.0.19-winx64

PATH中添加bin子目录

%MYSQL_HOME%\bin

以管理员身份运行cmd,执行初始化命令

mysqld --initialize --user=mysql --console

需要记住生成的临时密码:w?z2zjOrclga

注册mysql服务,执行命令

mysqld -install

  d: \ mysql \ mysql-8 .0.19 - winx64 > mysqld  - install
Service successfully installed .

启动mysql服务,执行命令

net start mysql

  d: \ mysql \ mysql-8 .0.19 - winx64 > net  start  mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

net stop mysql

  PS  D: \ wangc \ Program \ mysql-8 .0.20 - winx64 \ bin >  net  stop  mysql
MySQL 服务正在停止 .
MySQL 服务已成功停止。

登录mysql,执行命令

mysql -u root -p

输入刚才保存的临时密码

  d: \ mysql \ mysql-8 .0.19 - winx64 > mysql  - u  root  - p
Enter password : ************
Welcome to the MySQL monitor .   Commands end with ; or \ g .
Your MySQL connection id is 8
Server version : 8.0.19
?
Copyright ( c ) 2000 , 2020 , Oracle and / or its affiliates . All rights reserved .
?
Oracle is a registered trademark of Oracle Corporation and / or its
affiliates . Other names may be trademarks of their respective
owners .
?
Type ‘help;‘ or ‘\h‘ for help . Type ‘\c‘ to clear the current input statement .
?
mysql >

 

修改root用户的密码为root,执行命令

ALTER USER root@localhost IDENTIFIED BY ‘root‘;

  mysql >  ALTER  USER  root @localhost  IDENTIFIED  BY  ‘root‘ ;
Query OK , 0 rows affected ( 0.01 sec )

退出命令行中mysql模式,然后使用sqlyog登录mysql

exit

  mysql >  exit
Bye

sqlyog下载安装地址

https://HdhCmsTestcnblogs测试数据/tangbohu2008/p/11017235.html

mysql安装

标签:community   comment   sqlyog   alt   sql数据库   cli   and   mysql的安装   ror   

查看更多关于mysql安装的详细内容...

  阅读:27次