- Manually delete the data folder created by yourself
删除自行创建的data文件夹 - Then enter the bin directory under the administrator’s CMD and remove your mysqld service
mysqld -remove MySQL
Service successfully removed.
3. Execute mysqld — initialize execute in the bin directory of CMD
mysqld --initialize
the program will create the data folder and corresponding files in the dynamic MySQL folder
4. Execute in the bin directory, mysqld — install, and install the mysqld service
mysqld --install
- Run net start MySQL in the bin directory to start the MySQL service
net start mysql
Authentication plugin ‘caching_sha2_password’ reported error: Authentication requires secure connection.
报错:
【分析】mysql8默认使用插件caching_sha2_password,有些client连接报这个错误,需要拿到server的public key来加密password。
【解决】加参数可以解决:–get-server-public-key
mysql -u root-p --get-server-public-key
输入密码解决。
将text类型字段设置为索引
报错:
原因:mysql中不支持为text或blob类型的字段设置索引
解决:将text类型转换为char或varchar
alter table *biaoming* modify column *lieming* char(10);
报错:
原因:text在mysql中需要进行overflow存储,与varchar(255)效果相同,因此在转换为varchar时,需要转换为varchar(255)
解决:
alter table *biaoming* modify column *lieming* varchar(255);
再添加索引:
ALTER TABLE d_items ADD INDEX index_label (label);
成功!
Host is not allowed to connect to this MySQL server
原因:mysql本地服务器设置不允许远程登录
解决:修改root登录权限,修改访问域
查看当前访问域:
use mysql;
select host from user where user=‘root’;
修改root的访问域:
update user set host=‘%’ where user=‘root’;
将当前user和privilige表中的用户信息、权限设置保存到内存中,此时相应的设置修改在不重启MYSQL服务的情况下可自动生效。
flush privileges;
再次查看访问域
重启服务器以后重新远程连接。
连接效果: