标签:数据库操作 数据库连接 password 配置文件 enter
root@webwall:/home/xiachengjiao# vi/webwall/mysql/my.cnf(看配置文件中的参数)
root@webwall:/webwall/mysql/bin# ./mysql -u root -S /var/mysql1.sock -p
Enter password: Enter password:********
ERROR 2002 (HY000): Can‘t connect to local MySQL serverthrough socket ‘/var/mysql1.sock‘ (2)
提示连不上数据库
查找原因并解决
ps -A |grep mysql查看数据库进程并没有开启
xiachengjiao@webwall:/webwall/mysql/bin$sudo ./start.sh 开启数据库
[sudo] password for xiachengjiao:123456
ps -A |grep mysql 查看数据库进程是否开启,如下显示:
5466 pts/1 00:00:00 mysqld_safe
7420pxs/1 00:00:00 mysqld_safe
7725pxs/1 00:00:00 mysqld
7817pxs/1 00:00:00 mysqld
提示数据库进程已经开启
重新连接数据库
root@webwall:/webwall/mysql/bin# ./mysql -uroot -S /var/mysql1.sock -p
Enter password: Enter password:12wq12wq
数据库操作如下:
mysql> show databases;
mysql> use new_db;
mysql> show tables;
mysql> use local;
mysql> show tables;
mysql> select * from ww_role_t;
mysql> desc ww_role_t;
mysql> insert into ww_role_t(rolename,roledescribe, systemrole, permission) values("test","test", 1, "1111110000001111");
mysql> select * from ww_role_t;
mysql> delete ww_role_t where rolename ="test";
数据库连接&数据库进程&数据库操作,布布扣,bubuko.com
标签:数据库操作 数据库连接 password 配置文件 enter
原文地址:http://6450498.blog.51cto.com/6440498/1423894