如何安装mysql 5.7.34且修改密码和导入数据
sudo dpkg --list|grep mysql
sudo apt-get remove mysql-common
sudo apt-get autoremove --purge mysql-server-5 ##这里的版本写自己安装的
dpkg --list|grep mysql
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
dpkg -l |grep ^pc|awk '{print $2}' |sudo xargs dpkg -P
apt --fix-broken install
dpkg -i mysql-community-server_5.7.34-1ubuntu18.04_amd64.deb
sudo cat /etc/mysql/debian
mysql -u debian-sys-maint -p
use mysql;
update mysql.user set authentication_string=password('root') where user='root';
update mysql.user set authentication_string=PASSWORD('root'), plugin='mysql_native_password' where user='root';
grant all privileges on *.* to 'root'@'%' identified by 'root';
flush privileges;
exit;
sudo editor /etc/mysql/mysql.conf.d/mysqld.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
sudo service mysql start
mysql -uroot -p
use 数据库名;
source ***.sql
|