ubuntu下安装mysql
http://www.mysql.com/downloads/mysql
sudo groupadd mysql sudo useradd -r -g mysql mysql sudo passwd mysql
sudo tar zxvf ~/Downloads/mysql-5.5.29-linux2.6-x86_64.tar.gz -C /opt sudo mv /opt/mysql-5.5.29-linux2.6-x86_64 /opt/mysql sudo chown -R mysql:mysql /opt/mysql
sudo apt-get install libaio1 sudo apt-get -f install cd /opt/mysql sudo scripts/mysql_install_db --user=mysql --basedir=. --datadir=./data
sudo cp support-files/mysql.server /etc/init.d/mysql.server sudo cp support-files/my-medium.cnf /etc/my.cnf sudo mkdir /var/run/mysqld sudo mkdir /var/log/mysql sudo chown mysql:mysql /var/run/mysqld sudo chown mysql:mysql /var/log/mysql
sudo gedit /etc/init.d/mysql.server
basedir="/opt/mysql"
sudo gedit /etc/my.cnf
在[client]下添加 default-character-set=utf8 在[mysqld]下添加 character-set-server=utf8(mysql5.5之前版本添加default-character-set=utf8)
sudo service mysql.server start # [start|stop|status] 或者 sudo /etc/init.d/mysql.server start # [start|stop|status]
sudo /opt/mysql/bin/mysqladmin -u root password root
sudo update-rc.d mysql.server defaults # 取消开机启动 # sudo update-rc.d -f mysql.server remove
以下是mysql日常操作:
sudo rm -rf /etc/mysql
mysql -uroot -p use mysql; select host, user from user; grant all privileges on *.* to root@'%' identified by "mypassword" WITH GRANT OPTION; FLUSH PRIVILEGES;
mysql -uroot -p use mysql; select host, user from user; revoke all privileges on *.* from root@'%'; delete from user where user='root' and host='%'; FLUSH PRIVILEGES;
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11