赞
踩
目录
jdk官网下载相应安装包:网址:Java Downloads | Oraclehttps://www.oracle.com/java/technologies/downloads/#java8-windows
1、在系统变量里新建如图所示变量:
变量名:JAVA_HOME
变量值:D:\Study\java\jdk1.8.0_321
2、再在系统变量里新建如图所示变量:
变量名:CLASSPATH
变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
3、在path变量下分别新建如下两个变量值
%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin
4、验证是否配置成功:打开cmd,
输入 java -version
javac -version
javaw
如图下图就证明成功啦!
1、在系统变量里新建如图所示变量:(根据自己的maven路径来)
变量名:MAVEN_HOME
变量值:D:\Study\Maven\apache-maven-3.8.4
2、打开path环境变量,然后新建如下路径
验证:打开cmd,输入mvn -v 显示版本信息就行
类似下图
3、我配好的settings.xml文件如下(我用的jdk1.8,所以这个文件里配置的默认jdk为1.8的,如果不一致,自己就可以改,比如你用jdk17,把1.8改成17即可)
- <?xml version="1.0" encoding="UTF-8"?>
-
- <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
- <!--
- | This is the configuration file for Maven. It can be specified at two levels:
- |
- | 1. User Level. This settings.xml file provides configuration for a single user,
- | and is normally provided in ${user.home}/.m2/settings.xml.
- |
- | NOTE: This location can be overridden with the CLI option:
- |
- | -s /path/to/user/settings.xml
- |
- | 2. Global Level. This settings.xml file provides configuration for all Maven
- | users on a machine (assuming they're all using the same Maven
- | installation). It's normally provided in
- | ${maven.conf}/settings.xml.
- |
- | NOTE: This location can be overridden with the CLI option:
- |
- | -gs /path/to/global/settings.xml
- |
- | The sections in this sample file are intended to give you a running start at
- | getting the most out of your Maven installation. Where appropriate, the default
- | values (values used when the setting is not specified) are provided.
- |
- |-->
- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
- <!-- localRepository
- | The path to the local repository maven will use to store artifacts.
- |
- | Default: ${user.home}/.m2/repository
- <localRepository>/path/to/local/repo</localRepository>
- -->
- <localRepository>C:/Program Files/Maven/repository</localRepository>
- <!-- interactiveMode
- | This will determine whether maven prompts you when it needs input. If set to false,
- | maven will use a sensible default value, perhaps based on some other setting, for
- | the parameter in question.
- |
- | Default: true
- <interactiveMode>true</interactiveMode>
- -->
-
- <!-- offline
- | Determines whether maven should attempt to connect to the network when executing a build.
- | This will have an effect on artifact downloads, artifact deployment, and others.
- |
- | Default: false
- <offline>false</offline>
- -->
-
- <!-- pluginGroups
- | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
- | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
- | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
- |-->
- <pluginGroups>
- <!-- pluginGroup
- | Specifies a further group identifier to use for plugin lookup.
- <pluginGroup>com.your.plugins</pluginGroup>
- -->
- </pluginGroups>
-
- <!-- proxies
- | This is a list of proxies which can be used on this machine to connect to the network.
- | Unless otherwise specified (by system property or command-line switch), the first proxy
- | specification in this list marked as active will be used.
- |-->
- <proxies>
- <!-- proxy
- | Specification for one proxy, to be used in connecting to the network.
- |
- <proxy>
- <id>optional</id>
- <active>true</active>
- <protocol>http</protocol>
- <username>proxyuser</username>
- <password>proxypass</password>
- <host>proxy.host.net</host>
- <port>80</port>
- <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
- </proxy>
- -->
- </proxies>
-
- <!-- servers
- | This is a list of authentication profiles, keyed by the server-id used within the system.
- | Authentication profiles can be used whenever maven must make a connection to a remote server.
- |-->
- <servers>
- <!-- server
- | Specifies the authentication information to use when connecting to a particular server, identified by
- | a unique name within the system (referred to by the 'id' attribute below).
- |
- | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
- | used together.
- |
- <server>
- <id>deploymentRepo</id>
- <username>repouser</username>
- <password>repopwd</password>
- </server>
- -->
-
- <!-- Another sample, using keys to authenticate.
- <server>
- <id>siteServer</id>
- <privateKey>/path/to/private/key</privateKey>
- <passphrase>optional; leave empty if not used.</passphrase>
- </server>
- -->
- </servers>
-
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a repository to use in resolving certain artifacts.
- | However, this repository may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That repository definition will have a unique id, so we can create a mirror reference for that
- | repository, to be used as an alternate download site. The mirror site will be the preferred
- | server for that repository.
- |-->
-
- <!-- mirror
- <mirrors>
- | Specifies a repository mirror site to use instead of a given repository. The repository that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- <mirror>
- <id>mirrorId</id>
- <mirrorOf>repositoryId</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://my.repository.com/repo/path</url>
- </mirror>
- </mirrors>
- -->
- <mirrors>
- <mirror>
- <id>alimaven</id>
- <name>aliyun maven</name>
- <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
- <mirrorOf>central</mirrorOf>
- </mirror>
- <mirror>
- <id>central</id>
- <name>Maven Repository Switchboard</name>
- <url>http://repo1.maven.org/maven2/</url>
- <mirrorOf>central</mirrorOf>
- </mirror>
- <mirror>
- <id>repo2</id>
- <mirrorOf>central</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://repo2.maven.org/maven2/</url>
- </mirror>
- <mirror>
- <id>ibiblio</id>
- <mirrorOf>central</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
- </mirror>
- <mirror>
- <id>jboss-public-repository-group</id>
- <mirrorOf>central</mirrorOf>
- <name>JBoss Public Repository Group</name>
- <url>http://repository.jboss.org/nexus/content/groups/public</url>
- </mirror>
- <!-- 中央仓库在中国的镜像 -->
- <mirror>
- <id>maven.net.cn</id>
- <name>oneof the central mirrors in china</name>
- <url>http://maven.net.cn/content/groups/public/</url>
- <mirrorOf>central</mirrorOf>
- </mirror>
- </mirrors>
- <!-- profiles
- | This is a list of profiles which can be activated in a variety of ways, and which can modify
- | the build process. Profiles provided in the settings.xml are intended to provide local machine-
- | specific paths and repository locations which allow the build to work in the local environment.
- |
- | For example, if you have an integration testing plugin - like cactus - that needs to know where
- | your Tomcat instance is installed, you can provide a variable here such that the variable is
- | dereferenced during the build process to configure the cactus plugin.
- |
- | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
- | section of this document (settings.xml) - will be discussed later. Another way essentially
- | relies on the detection of a system property, either matching a particular value for the property,
- | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
- | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
- | Finally, the list of active profiles can be specified directly from the command line.
- |
- | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
- | repositories, plugin repositories, and free-form properties to be used as configuration
- | variables for plugins in the POM.
- |
- |-->
- <!-- profile
- <profiles>
- | Specifies a set of introductions to the build process, to be activated using one or more of the
- | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
- | or the command line, profiles have to have an ID that is unique.
- |
- | An encouraged best practice for profile identification is to use a consistent naming convention
- | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
- | This will make it more intuitive to understand what the set of introduced profiles is attempting
- | to accomplish, particularly when you only have a list of profile id's for debug.
- |
- | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
- <profile>
- <id>jdk-1.4</id>
- <activation>
- <jdk>1.4</jdk>
- </activation>
- <repositories>
- <repository>
- <id>jdk14</id>
- <name>Repository for JDK 1.4 builds</name>
- <url>http://www.myhost.com/maven/jdk14</url>
- <layout>default</layout>
- <snapshotPolicy>always</snapshotPolicy>
- </repository>
- </repositories>
- </profile>
- -->
-
- <!--
- | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
- | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
- | might hypothetically look like:
- |
- | ...
- | <plugin>
- | <groupId>org.myco.myplugins</groupId>
- | <artifactId>myplugin</artifactId>
- |
- | <configuration>
- | <tomcatLocation>${tomcatPath}</tomcatLocation>
- | </configuration>
- | </plugin>
- | ...
- |
- | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
- | anything, you could just leave off the <value/> inside the activation-property.
- |
- <profile>
- <id>env-dev</id>
- <activation>
- <property>
- <name>target-env</name>
- <value>dev</value>
- </property>
- </activation>
- <properties>
- <tomcatPath>/path/to/tomcat/instance</tomcatPath>
- </properties>
- </profile>
-
- -->
- <profiles>
- <profile>
- <id>jdk-1.8</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <jdk>1.8</jdk>
- </activation>
-
- <properties>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
- </properties>
- </profile>
- </profiles>
-
-
-
- <!-- activeProfiles
- | List of profiles that are active for all builds.
- |
- <activeProfiles>
- <activeProfile>alwaysActiveProfile</activeProfile>
- <activeProfile>anotherAlwaysActiveProfile</activeProfile>
- </activeProfiles>
- -->
- </settings>
-
-
1、数据库官方下载MySQL官方下载https://dev.mysql.com/downloads/mysql/
我就喜欢下载最新版,无所畏惧(偷笑),下载后解压到任意目录下(路径里不要有中文)。
接下来点击"No thanks,just start mydownload",等待下载好。
2、在系统变量path下,配置mysql路径。
3、 编写my.ini文件,修改basedir的路径,放到mysql-8.0.28-winx64目录下,
注意:最好清除文件里的汉字即把注释删掉,否则可能会报乱码的错。如果你安装的是8.0版本以下的一定要看注释
[client] # 设置mysql客户端连接服务器时默认使用的端口 port=3306 # 设置mysql客户端默认字符集 default-character-set=utf8mb4 [mysqld] # 设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=C:\\Program Files\\mysql-8.0.28-winx64 # 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错 # datadir=C:\\Program Files\\mysql-8.0.28-winx64\\data # 允许最大连接数 max_connections=20 # 服务端使用的字符集默认为utf8mb4 character-set-server=utf8mb4 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8mb4
创建新表时校对集为utf8mb4_general_ci,mysql8.0默认选择字符集为utf8mb4,校对集为utf8mb4_0900_ai_ci,而mysql5.7没有此校对集,故sql文件导入mysql5.7版本时会报错解决方法就是把校对集改为mysql5.7有的校对集:utf8mb4_general_ci或utf8mb4_bin
collation-server=utf8mb4_general_ci
至于字符集为什么设置成utf8mb4,因为用utf8初始化时,cmd里有[warning]警告,建议我使用utf8mb4.
4、打开cmd,一定要以管理员身份运行,否则mysql不会部署成功的
//初始化数据库
mysqld --initialize --console
//数据库安装
mysqld install + 你的数据库的名字
例如你起的数据库的名称为mysql8,命令就为mysqld install mysql8,如果不加名字,数据库就为默认的名字“mysql”,其命令就是mysqld install,我这里使用的是默认的名字
//开启数据库服务
net start mysql
//登录数据库
mysql -uroot -p"粘贴初始密码"
这种把密码放在命令行上的方式,能检查密码是否粘贴正确!cmd里会报出警告说“把密码放在命令行上不安全”,这个完全可以忽略!
回车之后,就是下图这个样子
//登录进mysql之后修改密码,赋予root用户最高权限(可选)
① ALTER USER 'root'@'localhost' IDENTIFIED BY '新的密码';
② flush privileges;
//退出mysql,再使用自己的密码验证登录一下,看成功了没
exit
5、那么我们去sqlyog里连接一下去试试看
错误号码2058与MySQL用户认证插件有关。在MySQL 8.0及以上版本中,默认采用caching_sha2_password认证插件,而许多MySQL图形化管理工具或旧版MySQL客户端不支持该插件,因此会导致连接失败并抛出错误号码2058。出现该问题后,有以下两种解决方法:
1、修改MySQL用户认证插件
修改MySQL用户认证插件为mysql_native_password,可以通过执行以下语句实现:
①ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
③刷新一下权限:flush privileges;
其中,'root'@'localhost'是指需要修改密码的用户和主机名,'password'是你的密码。
2、升级MySQL客户端或图形化管理工具
升级到支持caching_sha2_password认证插件的MySQL客户端或图形化管理工具,如最新版的MySQL Workbench、Navicat for MySQL、HeidiSQL等。
重新登一下sqlyog:
6、卸载mysql的命令(谨慎操作),如果哪一天mysql被你搞炸了就比如误删除了mysql里原有的一些数据库或文件而无法撤销时,我们可以选择卸载重新安装mysql,先停止mysql才可以卸载
mysqld -remove 你的数据库的名字
我的数据库的名字为mysql,所以是mysqld -remove mysql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。