当前位置:Gxlcms > mysql > Ubuntu下MySQL解压安装_MySQL

Ubuntu下MySQL解压安装_MySQL

时间:2021-07-01 10:21:17 帮助过:7人阅读

Ubuntu

1.Ubuntu下解压到/usr/local/mysql
groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
chown -R root .
chown -R mysql data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

2.修改my.cnf
nano /etc/my.cnf
添加
basedir=/usr/local/mysql
datadir=/home/mysql

3.初始化数据库
scripts/mysql_install_db --user=mysql

4.启动
bin/mysqld_safe --user=mysql &
修改密码
mysql>use mysql
mysql>UPDATE user SET password=PASSWORD('root') WHERE user='root';
mysql>FLUSH PRIVILEGES;
mysql>exit

5.设置自动启动
apt-get install chkconfig
chkconfig --add mysqld
chkconfig mysqld on

6.将mysql加入到path
nano /etc/profile
umask前加进这句
export PATH=$PATH:/usr/local/mysql/bin

7.重启系统
reboot

人气教程排行