时间:2021-07-01 10:21:17 帮助过:3人阅读
2、解压
| 1234 | #解压tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz#复制解压后的mysql目录cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql |
3、添加用户组和用户
| 1234 | #添加用户组groupadd mysql#添加用户mysql 到用户组mysqluseradd -g mysql mysql |
4、安装
| 123456789101112131415161718192021222324252627282930 |
修改目录拥有者为mysql用户:chown -R mysql:mysql ./安装数据库:./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql这一步可能报错:找不到
chmod 755 /etc/init.d/mysqld
#修改启动脚本vi /etc/init.d/mysqld #修改项:basedir=/usr/local/mysql/datadir=/usr/local/mysql/data/mysql #启动服务service mysqld start #测试连接./bin/mysql -uroot -p(需要创建密码)
#启动mysqlservice mysqld start#关闭mysqlservice mysqld stop#查看运行状态service mysqld status |
5、错误
5.1 sqlyog连接时,报1130错误,是由于没有给远程连接的用户权限问题
解决1:更改 ‘mysql’数据库‘user’表‘host’项,从‘localhost’改成‘%’。
use mysql;select ‘host‘ from user where user=‘root‘; update user set host = ‘%‘ where user =‘root‘; flush privileges;
解决2:直接授权
GRANT ALL PRIVILEGES ON *.* TO ‘root’@‘%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION;
5.2 安装时的一些错误
-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: 没有那个文件或目录
解决: yum -y install perl perl-devel
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决:yum -y install libaio-devel
6、添加进入开机启动服务
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
添加服务:chkconfig --add mysqld
显示服务列表:chkconfig --list
Linux下安装mysql
标签:linux mysql