当前位置:网站首页>MySQL8. 0 upgraded stepping on the pit Adventure
MySQL8. 0 upgraded stepping on the pit Adventure
2022-04-23 11:06:00 【liming89】
Source of the article : Learn through http://www.bdgxy.com/
Preface
I've been busy lately Fighting Project , So the pen is a little lax , You shouldn't have .
Just met the need from MySQL5.7.33 Upgrade to MySQL8.0.x The needs of , So record the whole upgrade process , Step over the pit .
Background outline : Local docker Used in containers MySQL yes 5.7.33( The mirror system uses ubuntu16.04), And the new project uses... Online MySQL8.0. Exported from online sql file ( Table structure + data ) There is a lower version of MySQL Character encoding that will not be used , An error will be reported as soon as you import , The character set error encountered is as follows :
- Unknown collation: 'utf8mb4_0900_ai_ci'
After a search , I also calmed down , There are two ways of thinking , One is what I call the "cover your ears and steal your bells" solution , One is a radical cure .
The ostrich , seeing the name of a thing one thinks of its function , Don't solve the essential problem , Instead, it solves the problem of error reporting by replacing character sets in batches , That is, all the in the file utf8mb4_0900_ai_ci Replace with :utf8_general_ci.
The second is to keep in touch with the online MySQL Versions, , This will support the character set .
So I used the second method , Upgrade my docker In container MySQL, By the way, you can also package a new image .
The upgrade process is also a little bumpy , But the logic is clear .
1. First completely uninstall the existing version MySQL.
You can use the following command :
# Delete mysql Data files for sudo rm -R /var/lib/mysql/ # Delete mysql Configuration file for
sudo rm -R /etc/mysql/
# Auto uninstall mysql( Include server and client)
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
Remember to delete the configuration file , Because it may not be compatible .
2. download deb And in accordance with the MySQL8.x.
You can download it on the official website , The official website address is https://dev.mysql.com/repo/apt
We choose the latest deb download , The website is :
https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb. Use... After command wget Command to download , as follows :
wget https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb
After downloading, use dpkg Command and update apt Source , Then you can install , The complete command is as follows :
dpkg -i mysql-apt-config_0.8.20-1_all.deb apt-get update apt-get install -y mysql-server
During the last command execution , It will let you enter root Password and some basic configuration , Then you can complete the installation .
Because it is ubuntu It's installed inside MySQL, So the startup mode is :
service mysql start
You can use the command to see how the process is running , It is similar in normal time. If you need to output :
/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock
3. Create users and configure permissions .
MySQL8.0.x During the actual use, it is found that the user authorization is a little different from the previous version , There are three steps :
- Create user .
- Assign permissions .
- Refresh the permissions .
Concrete sql The statement is as follows , The order is also strict :
create user 'freephp'@'%' identified by '176serTTc8Cg';
grant all privileges on dev_database.* to ‘freephp’@‘%’ with grant option;
flush privileges;
above sql Explain it. , The first sentence is to create a project called freephp Users of , The password for 176serTTc8Cg,% Represents that any host can be connected .
The second sentence means to dev_database Give all permissions to the user freephp.
The third sentence is to refresh permissions immediately , Make the newly created permission effective .
Since then, the adventure has been completed ,MySQL8.0 New features need to be explored , Chat next time .
summary
This is about MySQL8.0 This is the article on upgrading stepping on the pit , More about MySQL8.0 To upgrade the content of stepping on the pit, please search the rookie tutorial www.piaodoo.com Previous articles or continue to browse the relevant articles below. I hope you can support rookie tutorials in the future www.piaodoo.com!
版权声明
本文为[liming89]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231102124239.html
边栏推荐
- Facing the global market, platefarm today logs in to four major global platforms such as Huobi
- Which company is good for opening futures accounts? Who can recommend several safe and reliable futures companies?
- JDBC – PreparedStatement – 如何设置 Null 值?
- Source insight 4.0 FAQs
- Anaconda3 installation
- Mba-day5 Mathematics - application problems - engineering problems
- How to bind a process to a specified CPU
- Intuitive understanding entropy
- CUMCM 2021-B:乙醇偶合制备C4烯烃(2)
- Data analysis learning (I) data analysis and numpy Foundation
猜你喜欢
Visual solutions to common problems (VIII) mathematical formulas
Excel · VBA array bubble sorting function
比深度学习更值得信赖的模型ART
STM32接电机驱动,杜邦线供电,然后反烧问题
vm设置静态虚拟机
Visual common drawing (V) scatter diagram
Intuitive understanding entropy
Excel · VBA custom function to obtain multiple cell values
Mysql8.0安装指南
Let the LAN group use the remote device
随机推荐
Visual common drawing (III) area map
The songbird document editor will be open source: starting with but not limited to markdown
mysql创建存储过程及函数详解
Notes on concurrent programming of vegetables (IX) asynchronous IO to realize concurrent crawler acceleration
Upgrade the functions available for cpolar intranet penetration
Mysql排序的特性详情
Explain in detail the pitfalls encountered in DTS due to the time zone problems of timestamp and datetime in MySQL
MySQL数据库事务transaction示例讲解教程
期货开户哪个公司好?安全靠谱的期货公司谁能推荐几家?
Code implementation of general bubbling, selection, insertion, hill and quick sorting
Which company is good for opening futures accounts? Who can recommend several safe and reliable futures companies?
Gets the current time in character format
Facing the global market, platefarm today logs in to four major global platforms such as Huobi
MySQL索引优化之分页探索详细介绍
闹钟场景识别
Visual common drawing (V) scatter diagram
Jupyter lab top ten high productivity plug-ins
Mysql系列SQL查询语句书写顺序及执行顺序详解
SWAT—Samba WEB管理工具介绍
学习 Go 语言 0x02:对切片 Slice 的理解