去官网下载MySQL:点我直达html
百度云盘地址:连接: https://pan.baidu.com/s/1qBN4r6t8gvq-I4CFfQQ-EA 密码: hei3
若查询出结果,代码已经安装过MySQL,咱们卸载Linux自带的版本mysql
若是有,就执行rm -rf xxxxsql
若没有,则建立数据库
务必记住初始化输出日志末尾的密码(数据库管理员临时密码)测试
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
datadir=/usr/local/mysql/data
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=400
innodb_file_per_table=1
#表名大小写不明感,敏感为
lower_case_table_names=1
#跳过权限表,添加该命令
# skip-grant-tables
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
service mysql restart
use mysql #访问mysql库
update user set host = '%' where user = 'root'; #使root能再任何host访问
FLUSH PRIVILEGES; #刷新
一、将服务文件拷贝到init.d下,并重命名为mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
二、赋予可执行权限
chmod +x /etc/init.d/mysqld
三、添加服务
chkconfig --add mysqld
四、显示服务列表
chkconfig --list