下载的官方压缩包,压缩包里面没有my.ini
拷贝的原来的5.5的,
把Myisam的参数去掉了,剩下以下这些:
01 | # MySQL Server Instance Configuration File |
02 | # ---------------------------------------------------------------------- |
03 | # Generated by the MySQL Server Instance Configuration Wizard |
04 | # |
05 | # |
06 | # Installation Instructions |
07 | # ---------------------------------------------------------------------- |
08 | # |
09 | # On Linux you can copy this file to /etc/my.cnf to set global options, |
10 | # mysql-data-dir/my.cnf to set server-specific options |
11 | # (@localstatedir@ for this installation) or to |
12 | # ~/.my.cnf to set user-specific options. |
13 | # |
14 | # On Windows you should keep this file in the installation directory |
15 | # of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To |
16 | # make sure the server reads the config file use the startup option |
17 | # "--defaults-file". |
18 | # |
19 | # To run run the server from the command line, execute this in a |
20 | # command line shell, e.g. |
21 | # mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini" |
22 | # |
23 | # To install the server as a Windows service manually, execute this in a |
24 | # command line shell, e.g. |
25 | # mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini" |
26 | # |
27 | # And then execute this in a command line shell to start the server, e.g. |
28 | # net start MySQLXY |
29 | # |
30 | # |
31 | # Guildlines for editing this file |
32 | # ---------------------------------------------------------------------- |
33 | # |
34 | # In this file, you can use all long options that the program supports. |
35 | # If you want to know the options a program supports, start the program |
36 | # with the "--help" option. |
37 | # |
38 | # More detailed information about the individual options can also be |
39 | # found in the manual. |
40 | # |
41 | # |
42 | # CLIENT SECTION |
43 | # ---------------------------------------------------------------------- |
44 | # |
45 | # The following options will be read by MySQL client applications. |
46 | # Note that only client applications shipped by MySQL are guaranteed |
47 | # to read this section. If you want your own MySQL client program to |
48 | # honor these values, you need to specify it as an option during the |
49 | # MySQL client library initialization. |
50 | # |
51 | [client] |
52 |
53 | port=3306 |
54 |
55 | [mysql] |
56 |
57 | default-character- set =utf8 |
58 |
59 |
60 | # SERVER SECTION |
61 | # ---------------------------------------------------------------------- |
62 | # |
63 | # The following options will be read by the MySQL Server. Make sure that |
64 | # you have installed the server correctly (see above) so it reads this |
65 | # file. |
66 | # |
67 | [mysqld] |
68 |
69 | # The TCP/IP Port the MySQL Server will listen on |
70 | port=3306 |
71 |
72 | #定义时区 |
73 | default- time -zone= '+08:00' |
74 |
75 | #Path to installation directory. All paths are usually resolved relative to this. |
76 | basedir= "E:/webhome/mysql-8.0.19" |
77 |
78 | #Path to the database root |
79 | #datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.5/Data/" |
80 | datadir= "E:/webhome/mysql-8.0.19/data" |
81 |
82 | # The default character set that will be used when a new schema or table is |
83 | # created and no character set is defined |
84 | character- set -server=utf8 |
85 |
86 | # The default storage engine that will be used when create new tables when |
87 | default-storage-engine=INNODB |
88 |
89 | # The maximum amount of concurrent sessions the MySQL server will |
90 | # allow. One of these connections will be reserved for a user with |
91 | # SUPER privileges to allow the administrator to login even if the |
92 | # connection limit has been reached. |
93 | max_connections=100 |
94 |
95 |
96 | # 默认使用“mysql_native_password”插件认证 |
97 | default_authentication_plugin=mysql_native_password |
最后一句是加上去的,原来5.5的配置里面没有。
下一步:
输入命令,需要是在管理员模式下,并且切换到bin目录:
1 | mysqld –initialize |
再次执行,会在data目录下生成文件。生成文件很多,如果只有两个文件,那就是遇到错误了。
直接打开data目录下,你的主机名.err的文件,里面有错误描述。
特别注意,再次执行上面命令时,需要删除掉data目录下的文件。
执行后,如果卡顿一段时间,并在data目录下生成文件夹及很多文件,表示成功。这个时候可以执行:
1 | mysqld install |
注册服务,注册成功后,用net start mysql启动服务。
启动后,root密码在data目录下,刚才看错误的那个文件中
1 | [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <o15=l1rTD9l |
找到这个密码,在命令提示行下登录mysql。
到这里还没完。你登录后,使用Use命令时,会提示:
1 | ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. |
然后就需要执行命令:
[#zeyu#]
1 | alter user user() identified by "你要设置的新密码" ; |
[/#zeyu#]
这样,就可以使用新密码了。但是如果像我是从5.5升级的,而且还有很多表是MyIsAM的话,就比较麻烦了。目前还未处理。
------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------
转载请注明本文标题和链接:《终于还是把本地的MySQL从5.5升级到了8.0》
发表评论