mysql安裝:./bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
service mysqld stop
設定mysql密碼:
set password = password('root');
或
set password for 'root'@'%' = password('newpass');flush privileges;
以格式化輸出結果:select * from user\g;
修改可遠端訪問
select host, user from user;
直接修改模式:
update user set host = '%' where user = 'root' and host = 'localhost';
附加許可權模式:
grant all privileges on *.* to root@'%' identified by '123456';
flush privileges;
設定開機自動啟動
chkconfig --add mysqld
chkconfig mysqld on
設定path
vi /etc/profile
export path=/usr/local/mysql/bin:$path
問題:mysqld_safe directory '/var/run/mysqld' for unix socket file don't exists.
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
客戶端連線失敗:
error 2002 (hy000): can't connect to local mysql server through socket '/tmp/mysql.sock' (2)
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
mariadb安裝:
[root@yl-web yl]#yum install mariadb-server mariadb
mariadb資料庫的相關命令是:
systemctl start mariadb #啟動mariadb
systemctl stop mariadb #停止mariadb
systemctl restart mariadb #重啟mariadb
systemctl enable mariadb #設定開機啟動
mysql -u root -p
mysql-5.6.33安裝
MySQL使用筆記
刪除修改 查詢元資料操作 表結構調整 許可權管理 字符集設定 資料匯入和匯出 匯入資料 遠端連線mysql 資料庫備份和複製 mysql 程序資訊 編碼集問題 insert into ticket info buyer openid,ticket date values 000751a016bdbf...
mysql使用筆記
建立資料庫 create database database name 刪除資料庫 drop database database name 建立表 最簡單的語法 create table userinfo id int uname varchar 40 address varchar 120 hob...
mysql使用筆記
mysql通用建表語句 create table if not exists stuinfo id int primary key auto increment,自增,主鍵非空唯一,會建立主鍵索引 stuname varchar 20 not null,非空 gender char 1 seat i...