配置:
vi /etc/profile 打开文件后,在最后添加 export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib export PATH 退出编辑。 source /etc/profile/etc/my.cnf 配置, 直接复制进去即可。
[mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data socket = /usr/local/mysql/mysql.sock character-set-server=utf8 port = 3306 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [client] socket = /usr/local/mysql/mysql.sock default-character-set=utf8 # # include all files from the config directory # !includedir /etc/my.cnf.d启动mysql
service mysql start #返回 Redirecting to /bin/systemctl start mysql.service #数据库启动成功下面是数据库修改密码,外网访问,服务器需开放3306端口
mysql -uroot -p #输入刚才记录的密码,按回车 #修改密码 alter user 'root'@'localhost'IDENTIFIED BY '123456'; #创建用户aa,密码为123456 create user aa identified by '123456'; GRANT ALL ON *.* TO 'aa'@'%' WITH GRANT OPTION; Flush privileges; use mysql update user set host='%' where user ='root'; 更新域属性,'%'表示允许外部访问: FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;到此结束。连续装了三台服务器,记录下来,下次直接复制
# navicate连接时,2059错误。修改密码加密规则。 use mysql alter user 'root'@'%' IDENTIFIED BY '123' password expire never; alter user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123'; FLUSH PRIVILEGES;