当前位置:网站首页>05 Ubuntu installing mysql8

05 Ubuntu installing mysql8

2022-06-24 08:25:00 weixin_ forty-six million three hundred and seventy-one thousan

One : download MySQL APT Install configuration package

wget  https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb

Two : install MySQL

1、 Enter the following command , Enter the installation :

sudo dpkg -i mysql-apt-config_0.8.14-1_all.deb

2、 Up and down key selection ok , enter

install MySQL Server

1、 to update apt Software sources

sudo apt-get update

2、 install mysql Server

sudo apt-get install mysql-server

2.1、 I made a mistake :

W: GPG  error :http://repo.mysql.com/apt/ubuntu bionic InRelease:  Because there is no public key , The following signature could not be verified : NO_PUBKEY 467B942D3A79BD29
E:  Warehouse  “http://repo.mysql.com/apt/ubuntu bionic InRelease”  There is no digital signature .
N:  Cannot safely update with this source , So the source is disabled by default .
N:  See  apt-secure(8)  Manual for details of warehouse creation and user configuration .

2.2、 resolvent :

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29

# The following string : yes W:GPG Error reported  NO_PUBKEY 467B942D3A79BD29  

2.3、 Re install mysql server : sudo apt-get install mysql-server

3、 The following , It means that we are not installing mysql8 Version of , Installation is mysql 5.7.38【 If you don't want to use it MySQL5.7 edition , Skip to step 5】

 Setting up  mysql-server (5.7.38-0ubuntu0.18.04.1) ...
 Processing for  libc-bin (2.27-3ubuntu1.5)  The trigger of  ...
 Processing for  systemd (237-3ubuntu10.52)  The trigger of  ...
 Processing for  man-db (2.8.3-2ubuntu0.1)  The trigger of  ...
 Processing for  ureadahead (0.100.0-21)  The trigger of  ...
4、 I want to enter MySQL in ; After the installation is successful, the random password , Need to change password .
 see MySQL edition :mysql -V
 Get into MySQL client :mysql -uroot -p
 Report errors :ERROR 1698 (28000): Access denied for user 'root'@'localhost'

4 Solutions to reporting errors , Because the random password is generated , Need to change password .

4.1、 Go to configuration file , Set login without password

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

 To [mysqld]  Next   Join in :skip-grant-tables
 Save and exit :wq  
 restart mysql service :service mysql restart

4.2、 Get into MySQL, Set the password

1、 Get into MySQL client 
mysql -uroot -p 
 No password required , Directly enter 

2、 perform 
use mysql;

 update user set authentication_string=password("[email protected]"),plugin='mysql_native_password' where user='root';
 
flush privilegs;

3、 modify mysql The configuration file , Delete the sentence without entering the password .
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

 take [mysqld]  Under the  skip-grant-tables  Comment or delete 

4、 restart mysql
service mysql restart

4.3、 Re enter MySQL client

mysql -uroot [email protected] 
 Enter into MySQL after , Try creating a database 
create database test_db;
5、 If you don't want mysql5.7.38, You need to uninstall , Install again mysql8 edition

5.1、 uninstall mysql5.7 edition

1、 see mysql The dependencies of :
dpkg --list|grep mysql

2、 uninstall 
sudo apt-get remove mysql-common

3、 uninstall ( The last number depends on the version you downloaded , adopt mysql -V see )
sudo apt-get autoremove --purge mysql-server-5.7
 Select delete existing database 

4、 Clean up residual data 
dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P

5、 verification : Look at the dependencies again , None is displayed , Clean up 
dpkg --list|grep mysql
	 If there are other contents, execute :sudo apt-get autoremove --purge mysql-apt-config 
	 Again dpkg --list|grep mysql  View dependencies 
	
6、 install MyS5QL8.0

6.1、 download mysql package

wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

6.2、 install

sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

6.3、 Update software source

sudo apt update

6.4、 install MySQL8

sudo apt install mysql-server

6.5、 Set up root password , Through the down arrow , Select OK , enter

6.6、 See the default in the online tutorial mysql8.0 The encryption method is the same as ubuntu18.04 Are not compatible , So choose 5.x Encryption method of ; It is suggested to choose the one below :

 choice  (Retain MYSQL 5.x Compatibility)  after , Click enter , perform 

6.7、 See below , The installation is mysql8 了

 Setting up  mysql-server (8.0.29-1ubuntu18.04) ...
 Processing for  man-db (2.8.3-2ubuntu0.1)  The trigger of  ...
 Processing for  libc-bin (2.27-3ubuntu1.5)  The trigger of  ...

7、 Get into mysql The client validates

1、 see mysql edition 
mysql -V
2、 Get into MySQl client 
mysql -uroot [email protected]
原网站

版权声明
本文为[weixin_ forty-six million three hundred and seventy-one thousan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240539166603.html