$ sudo /etc/init.d/mysql stop $ sudomkdir /var/run/mysqld $ sudochown mysql /var/run/mysqld $ sudo mysqld_safe --skip-grant-tables& $ mysql -uroot -p mysql> UPDATE mysql.user SET authentication_string=null WHERE User='root'; mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; mysql> flush privileges;
重启服务
1 2
$ sudo killall -u mysql $ sudo /etc/init.d/mysql start
二、在数据库插入数据
查看数据库
1 2 3
mysql>SHOW DATABASES; mysql>CREATE DATABASE test_db; mysql> use test_db;
创建表
1 2 3 4 5 6 7
createtable tb_tmp01 ( id INT(11), name VARCHAR(25) );