linux安装mysql时给/var/lib/mysql赋予权限 5C

Linux中安装完mysql之后,
1.用service mysql start启动时,报错没有mysql.service这个文件或者目录
2.此时ls -l 了一下/var/lib之后显示
drwxr-x--x 5 mysql mysql 4096 May 16 19:05 mysql
3.执行命令chown mysql:mysql /var/lib/mysql –R之后mysql正常启动了
4.此时ls -l 了一下/var/lib之后显示
drwxr-x--x 5 mysql mysql 4096 May 16 19:05 mysql

问题:我就纳闷了,这执行命令chown mysql:mysql /var/lib/mysql –R前后 /var/lib/mysql的权限、所属用户、所属组都没变啊,为什么mysql就可以启动了?

2个回答

看一下-R的意思 你就明白了

可以看看mysql启动失败的时候的错误日志,是什么权限配置有问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Linux 安装 MySQL 到mysql_install_db --user=mysql执行出错

linux 手动编译安装 mysql 完成后 执行 /usr/local/mysql/bin/mysql_install_db --user=mysql 出错.. 以下是错误信息.. 我还是没太明白... 帮忙看下... Installing MySQL system tables... 110823 20:55:57 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead. /usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13) 110823 20:55:57 [ERROR] Aborting 110823 20:55:57 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete Installation of system tables failed! Examine the logs in /var/lib/mysql for more information. You can try to start the mysqld daemon with: shell> /usr/local/mysql/libexec/mysqld --skip-grant & and use the command line tool /usr/local/mysql/bin/mysql to connect to the mysql database and look at the grant tables: shell> /usr/local/mysql/bin/mysql -u root mysql mysql> show tables Try 'mysqld --help' if you have problems with paths. Using --log gives you a log in /var/lib/mysql that may be helpful. Please consult the MySQL manual section 'Problems running mysql_install_db', and the manual section that describes problems on your OS. Another information source are the MySQL email archives available at http://lists.mysql.com/. Please check all of the above before mailing us! And remember, if you do mail us, you MUST use the /usr/local/mysql/bin/mysqlbug script!

laradock改变DATA_PATH_HOST,mysql启动时报错'/var/lib/mysql/._mysql': Operation not permitted

尝试过的方法: 1、在运行容器的时候,给容器加特权,及加上 --privileged=true 参数 docker run -i -t -v /data/mysql/data:/data/var-3306 --privileged=true b0387b8279d4 /bin/bash -c "/opt/start_db.sh" 2、临时关闭selinux setenforce 0 3、添加selinux规则,改变要挂载的目录的安全性文本: 可能使用方法不对,求解

无法通过套接字'/var/lib/mysql/mysql.sock'连接到本地MySQL服务器。 共享服务器不支持此功能。如何解决此问题? [关闭]

<div class="post-text" itemprop="text"> <p>This is not supported on the shared hosting server, Any idea?</p> <pre><code>Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) </code></pre> </div>

linux上mysql可以正常启动,却打mysql提示错误进不去

service mysqld start Starting mysqld: [ OK ] [root@chanct201 etc]# [root@chanct201 etc]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '--default-character-set=utf8' (2) [root@chanct201 etc]# service mysqld status mysqld (pid 20759) is running... 谁知道是什么问题,是我什么地方配置错了吗? [root@abc etc]# cat /etc/my.cnf [mysqld] #datadir=/var/lib/mysql datadir=/home/data/mysql basedir= /usr socket=/var/lib/mysql/mysql.sock #socket=/home/data/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 default-character-set=utf8 #default--character-set-server=utf8 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] default-character-set=utf8 /var/lib/mysql/mysql.sock [mysql] default-character-set=utf8

centos安装pdo_mysql扩展不成功

环境:Centos 7 在PHP5.4.16的基础上安装pdo_mysql扩展不成功。 我的按照步骤: 1)在PHP安装包的ext下找到pdo_mysql; 2)执行]$ phpize 3) 执行:$ ./configure --with-php-config=/usr/bin/php-config --with-pdo-mysql=/var/lib/mysql 4)出错提示: checking for mysql_config... not found checking for mysql install under /var/lib/mysql... can not find it configure: error: Unable to find your mysql installation 我尝试这下面这些路径都不行 # whereis mysql mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz # which mysql /bin/mysql

怎么修复'ERROR 2002(HY000):无法通过套接字连接到本地MySQL服务器'/var/run/mysqld/mysqld.sock'(2“没有这样的文件或目录”)'

<div class="post-text" itemprop="text"> <p>I am trying to install docker in a laravel project. Everything seems to work, except that when I try to import data into my comic, I get this error:</p> <p>I import width command line: </p> <p><code>docker-compose exec app php artisan db:import --local</code></p> <p>I must also say that this is a large amount of data that I am trying to import</p> <blockquote> <p>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")</p> </blockquote> <p>I did research on the internet to find a solution. I saw many but none walked with me. </p> <p>I use docker to create a development environment. Here are my configurations</p> <h3>Dockerfile</h3> <pre><code>FROM php:7.1.20-fpm # Copy composer.lock and composer.json COPY composer.lock composer.json /var/www/ # Set working directory WORKDIR /var/www # Install dependencies RUN apt-get update &amp;&amp; apt-get install -y \ build-essential \ mysql-client \ libpng-dev \ libjpeg62-turbo-dev \ libfreetype6-dev \ locales \ zip \ jpegoptim optipng pngquant gifsicle \ vim \ unzip \ git \ curl # Clear cache RUN apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/* # Install extensions RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ RUN docker-php-ext-install gd # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Add user for laravel application RUN groupadd -g 1000 www RUN useradd -u 1000 -ms /bin/bash -g www www # Copy existing application directory contents COPY . /var/www # Copy existing application directory permissions COPY --chown=www:www . /var/www # Change current user to www USER www # Expose port 9000 and start php-fpm server EXPOSE 9000 CMD ["php-fpm"] </code></pre> <h3>docker-compose</h3> <pre><code>version: '3' services: #PHP Service app: build: context: . dockerfile: .docker/Dockerfile env_file: .env image: digitalocean.com/php container_name: app #restart: unless-stopped tty: true environment: SERVICE_NAME: app SERVICE_TAGS: dev working_dir: /var/www volumes: - ./:/var/www - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini networks: - app-network depends_on: - db - webserver #Nginx Service webserver: image: nginx:alpine container_name: webserver restart: unless-stopped tty: true ports: - "8000:80" - "443:443" volumes: - ./:/var/www - ./nginx/conf.d/:/etc/nginx/conf.d/ networks: - app-network #MySQL Service db: image: mysql:5.7.22 container_name: db restart: unless-stopped tty: true ports: - "13306:3306" environment: MYSQL_DATABASE: merchline MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} SERVICE_TAGS: dev SERVICE_NAME: mysql volumes: - dbdata:/var/lib/mysql/ - ./mysql/my.cnf:/etc/mysql/my.cnf networks: - app-network #Docker Networks networks: app-network: driver: bridge #Volumes volumes: dbdata: driver: local </code></pre> </div>

重置root密码时sudo mysqld_safe --skip-grant-tables&,/ var / lib / mysql错误

<div class="post-text" itemprop="text"> <p>I've been trying to reset my forgotten root password in mysql. When I first tried to stop my mysqld service and tried mysqld --skip-grant-tables I got this error</p> <blockquote> <p>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'</p> </blockquote> <p>(2) Ask Question the same problem here</p> <p><a href="https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run">ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)</a>.</p> <p>The top comment said to do something with the my.conf file and I found it here</p> <pre><code>orpheus@Roedelius:/etc/mysql$ ls conf.d debian-start my.cnf.fallback mysql.conf.d debian.cnf my.cnf mysql.cnf </code></pre> <p>I did'nt know what to do from here with the my.cnf file.</p> <p>opened my.cnf file in it has this in it besides comments -</p> <pre><code>!includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/ </code></pre> <p>so I tried the same method of restarting my mysql server and stopping it, then using --skip-grant-tables, but I got this error that time -</p> <pre><code> 2017-02-10T17:05:44.870970Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2017-02-10T17:05:44.872874Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2017-02-10T17:05:44.874547Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists </code></pre> <p>the same problem here <a href="https://stackoverflow.com/questions/42153059/mysqld-safe-directory-var-run-mysqld-for-unix-socket-file-dont-exists">mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists</a> . I followed the top answers steps doing this <code>mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld</code> and then tried getting into mysql with --skip-grant-tables again but now I'm getting this error</p> <pre><code>orpheus@Roedelius:/$ sudo mysqld_safe --skip-grant-tables &amp; [2] 17057 orpheus@Roedelius:/$ 2018-08-02T01:11:46.843096Z mysqld_safe Logging to syslog. 2018-08-02T01:11:46.845788Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2018-08-02T01:11:46.859083Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql </code></pre> <p>My terminal just says that now and not letting my type anything. All the answers I'm finding on stackoverflow to reset my root password just keep leading to errors and I'm not sure if Im breaking some things by following some of the directions to fix these errors. I'd appreciate any help with my current error and resetting my root password. </p> </div>

Ubuntu16.04 修改mysql 数据存储目录datadir 启动失败

Ubuntu16.04 修改mysql 数据存储目录datadir 启动失败 ,网上的各种方法都已经尝试,但是还是没有启动成功请教各位大神!!!!! 修改步骤 ## 创建 迁移文件夹 > cd /mnt > mkdir lib > cd lib && mkdir mysqldata > 数据存放在 /mnt/lib/mysqldata 修改所属用户 和所属用户组为 msyql > sudo chown -vR mysql:mysql /mnt/lib/mysqldata 修改权限 > sudo chmod -vR 700 /mnt/lib/mysqldata ### 迁移文件 停止服务 > sudo /etc/init.d/mysql stop 迁移数据 > cp -av /var/lib/mysql/* /mnt/lib/mysqldata # vim /etc/mysql/mysql.conf.d/mysqld.cnf 将 [mysqld] 组下的 datadir改为: datadir = /mnt/lib/mysqldata sudo vim /etc/apparmor.d/usr.sbin.mysqld 找到其中的 /var/lib/mysql/ r, /var/lib/mysql/** rwk, 两行权限声明,可以在前面加上#好注释掉。然后对照格式,加入新路径的权限声明: /mnt/lib/mysqldata/ r, /mnt/lib/mysqldata/** rwk 重启服务 配置文件修改成功后就可以重启数据库,重启数据库之前需要先重新载入apparmor配置文件,使用下面命令重新载入: > sudo /etc/init.d/apparmor restart >sudo /etc/init.d/mysql start 重启的时候 Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. failed! root@iZm5e472vz1trxejt8m5akZ:/etc/mysql# systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-06-23 00:55:37 CST; 25s ago Process: 13418 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS) Process: 13408 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 13417 (mysqld) CGroup: /system.slice/mysql.service └─13417 /usr/sbin/mysqld . 配置文件 内容 ``` # # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes # escpecially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location. # Here is entries for some specific programs # The following values assume you have at least 32M ram [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr # datadir = /var/lib/mysql datadir = /mnt/lib/mysqldata tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 0.0.0.0 # # * Fine Tuning # key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 # This replaces the startup script and checks MyISAM tables if needed # the first time they are touched myisam-recover-options = BACKUP #max_connections = 100 #table_cache = 64 #thread_concurrency = 10 # # * Query Cache Configuration # query_cache_limit = 1M query_cache_size = 16M # # * Logging and Replication # # Both location gets rotated by the cronjob. # Be aware that this log type is a performance killer. # As of 5.1 you can enable the log at runtime! #general_log_file = /var/log/mysql/mysql.log #general_log = 1 # # Error log - should be very few entries. # log_error = /var/log/mysql/error.log # # Here you can see queries with especially long duration #log_slow_queries = /var/log/mysql/mysql-slow.log #long_query_time = 2 #log-queries-not-using-indexes # # The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about # other settings you may need to change. #server-id = 1 #log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name # # * InnoDB # # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! # # * Security Features # # Read the manual, too, if you want chroot! # chroot = /var/lib/mysql/ # # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". # # ssl-ca=/etc/mysql/cacert.pem # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem ```

ERROR 2002(HY000):无法通过套接字连接到本地MySQL服务器'/Applications/MAMP/tmp/mysql/mysql.sock'(2)

<div class="post-text" itemprop="text"> <p>如标题所示,当我尝试从终端启动MySQL时收到错误:</p> <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) </code></pre> <p>我在运行时收到此错误:</p> <pre><code>/Applications/MAMP/Library/bin/mysql -u root -p </code></pre> <p>我在运行时没有收到此错误:</p> <pre><code>mysql -u root -p </code></pre> <p>但是问题是当我运行的时候 <code>mysql -u root -p</code> 它连接到错误的MySQL ...</p> 在OSX上,我有两个用户,主要用户(一个正在发生错误的用户)在运行上述命令时访问其自己的mySQL实例(为空)。 当我运行该命令时,辅助用户将访问不同的mySQL实例(具有所需数据的实例)。 当然问题是,我试图在主要用户上访问辅助用户MySQL实例(我应该注意,在注销之前,我已经做得更早了,现在出现此错误) 另外,我应该提到,MAMP已安装在辅助用户上(即使MAMP文件可以从任一用户访问); 并且使用MAMP gui来“启动服务器”时,辅助用户上没有问题,但是主要用户上Apache Server启动了,但是MySQL Server没有启动。 通过搜索,我听说可以运行<code>killall -9 mysqld</code>或者 <code>killall mysqld</code>然后再尝试一切(有意义)。但我没有成功。 此外,我看到你们还应运行其他两个命令以进行调试,虽然我不知道它们的含义,但我知道它返回了 <pre><code>ps -u mysql </code></pre> <pre><code>UID PID TTY TIME CMD </code></pre> <p>和返回的</p> <pre><code>ps -awwx | grep mysql </code></pre> <pre><code>8001 ?? 0:00.03 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 16527 ?? 0:00.43 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/MacBook-Pro.local.err --pid-file=/usr/local/var/mysql/MacBook-Pro.local.pid 81182 ?? 0:00.04 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log 18520 ttys002 0:00.00 grep mysql </code></pre> </div>

CentOS 7.6下docker使用volume方式安装mysql

命令如下: ``` docker run -d -p 3306:3306 --name mysql01 -v=/docker/mysql/config/my.cnf:/etc/my.cnf -v=/docker/mysql/data:/var/lib/mysql mysql/mysql-server ``` 已经在Host主机上创建对应的文件夹及文件目录,运行时出现以下错误: ``` Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/docker/mysql/config/my.cnf\\\" to rootfs \\\"/var/lib/docker/overlay2/1bde9f49f803dd3a24ba95e2d9355f6d14491d8a9db315f42c3f98711d866323/merged\\\" at \\\"/var/lib/docker/overlay2/1bde9f49f803dd3a24ba95e2d9355f6d14491d8a9db315f42c3f98711d866323/merged/etc/my.cnf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. ``` 有没有遇到同样问题的同学们。

我的托管公司在这里弄乱我:无法通过套接字'/var/lib/mysql/mysql.sock'(2)连接到本地MySQL服务器?

<div class="post-text" itemprop="text"> <p>I use the hosting company aPlus.net, and I can't seem to get past a connection error I'm getting when trying to process some php to write database content to a webpage, and I am curious as to if this is because my database appears to not be on the same server as the entire rest of my hosting account, and if there is a way to resolve this in my code? This is my first attempt at writing PHP, and it would be good to know if my code is wrong, or if my hosting company is messing me up. (and either way, how to fix it)</p> <p>Here's the code that's failing to pull from the database:</p> <pre><code>{ $con = mysql_connect("localhost","2p5dq9vxmy240651","MY_PASSWORD"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("felineasthma_2p5dq9vxmy240651", $con); $users_name = $_POST['name']; $users_comment = $_POST['requests']; $users_name = mysql_real_escape_string($users_name); $users_comment = mysql_real_escape_string($users_comment); $inputid = $_GET['id']; $query = " INSERT INTO `felineasthma_2p5dq9vxmy240651`.`submissions` (`id`, `name`, `requests`, `inputid`) VALUES (NULL, '$users_name', '$users_comment', '$inputid');"; mysql_query($query); echo "&lt;h2&gt;Your request has been processed, reload page.&lt;/h2&gt;"; mysql_close($con); } </code></pre> <p>and here's some screen captures from inside my hosting account (links because I don't have enough posts here yet to upload images, sorry):</p> <p><a href="https://i.stack.imgur.com/pBvlq.png" rel="nofollow noreferrer">felineasthma_2p5dq9vxmy240651 doesn't appear in my hosting account</a></p> <p><a href="https://i.stack.imgur.com/O3TJr.png" rel="nofollow noreferrer">yet it clearly exists in MySQL Manager, but on a different server</a></p> <p>I was even more confused while making the user for this database, as the control panel didn't allow me to make a username, it just randomly assigned one. Help? Advice?</p> </div>

linux服务器的数据库安装系统自带的mysql,

[root@localhost ~]# cd /usr/bin/ [root@localhost bin]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@localhost bin]# cd / [root@localhost /]# use mysql -bash: use: command not found [root@localhost /]# cd /usr/bin/ [root@localhost bin]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@localhost bin]# /mysql -bash: /mysql: 没有那个文件或目录 [root@localhost bin]# cd / [root@localhost /]# /usr/local/mysql -bash: /usr/local/mysql: 没有那个文件或目录 [root@localhost /]# /var/lib/mysql/ 怎么设置root密码啊?/usr/bin/mysql提示说mysql不是目录???这是为什么?

CentOS7 systemd管理mysql的一个问题

基础环境版本: CentOS7.3 原生mysql5.7 我是通过下载官网的rpm包进行安装mysql-server的, 问题现象: 通过使用官网下载的rpm安装好mysql-server后,在配置文件中配置好mysql服务端 ![图片说明](https://img-ask.csdn.net/upload/201809/25/1537865812_725068.jpg) 创建好相关目录,配置好权限后,使用systemct启动应用 但是当我查看启动的mysql进程时,突然发现pid-file是/var/run/mysqld/mysqld.pid,但是我配置中写的是/opt/mysql/3306/tmp/mysqld.pid![图片说明](https://img-ask.csdn.net/upload/201809/25/1537866258_197098.jpg) 查看了一下,发现/usr/lib/systemd/system/mysqld.service(mysql的systemd注册服务文件)中已经把mysql的pid文件名写死了![图片说明](https://img-ask.csdn.net/upload/201809/25/1537866276_212217.jpg) 再次尝试修改pid文件路径,改为/opt/mysql/3306/tmp/mysqld.pid![图片说明](https://img-ask.csdn.net/upload/201809/25/1537866343_369532.jpg) 使用systemctl daemon-reload重新加载mysqd.service文件 再次使用systemctl启动mysqld,但是这时,mysqld进程启动正常,pid文件也写入了正确的路径中,但是systemctl一直没有返回,另起一个section,用systemctl status mysqld查询状态,发现mysqld一直处于activating (start)状态![图片说明](https://img-ask.csdn.net/upload/201809/25/1537866644_455249.jpg) 这时mysql-server可以正常使用,systemctl start mysqld的进程强制停掉也不会影响正常使用,但mysqld的服务状态也不会变为正常的active (running) 兄弟们有遇到过类似的状况么??求解一下,这个是什么原理?

ubuntu 16.04 下安装mysql 数据库遇到如下问题,求大神帮忙解决

ubuntu 16.04 下安装mysql数据库遇到如下错误: 7月 19 17:24:07 wenyaxin-Lenovo-XiaoXin-310-15IKB systemd[1]: Failed to star... 7月 19 17:24:07 wenyaxin-Lenovo-XiaoXin-310-15IKB systemd[1]: mysql.service:... 7月 19 17:24:07 wenyaxin-Lenovo-XiaoXin-310-15IKB systemd[1]: mysql.service:... Hint: Some lines were ellipsized, use -l to show in full. dpkg: 处理软件包 mysql-server-5.7 (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 1 dpkg: 依赖关系问题使得 mysql-server 的配置工作不能继续: mysql-server 依赖于 mysql-server-5.7;然而: 软件包 mysql-server-5.7 尚未配置。 dpkg: 处理软件包 mysql-server (--configure)时出错: 依赖关系问题 - 仍未被配置 正在处理用于 libc-bin (2.23-0ubuntu9) 的触发器 ... 因为错误消息指示这是由于上一个问题导致的错误,没有写入 apport 报告。 正在处理用于 systemd (229-4ubuntu17) 的触发器 ... 正在处理用于 ureadahead (0.100.0-19) 的触发器 ... 在处理时有错误发生: mysql-server-5.7 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) 然后上网百度,基本上所有博客说的方法都是一样的。就是删除再弄 sudo rm /var/lib/mysql/ -R sudo rm /etc/mysql/ -R sudo apt-get autoremove mysql* --purge sudo apt-get remove apparmor // 输入Y回车 然后在装: sudo apt-get install mysql-server mysql-common //重新安装 我已经试过好几次了,都不行,每次删除之后,再安装,输入指令后, 然后就让设置密码,密码设置完后在过一会儿最后就又出现这个问题, 烦人,被这个问题困扰一下午了。我是刚接触linux系统,对这些根本 不了解,安装什么东西都是百度别人的教程,希望大神可以帮帮我, 出现这种情况是什么问题。

SQLSTATE [HY000] [2002]无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(2)

<div class="post-text" itemprop="text"> <p>I've got this error after transferring my website from my computer to a 1and1 server.</p> <p>I also get the following error, although I am not sure if it is directly related:</p> <blockquote> <p>Fatal error: Call to a member function prepare() on a non-object in /homepages/37/d153694643/htdocs/sites/mjbox/func/functions.php on line 29</p> </blockquote> <p>I tested the connection to my 1 and 1 server on a separate file and there are no errors.</p> <p>Here is most of my index.php</p> <p> </p><pre><code>//Check if the user is logged in loggedin(); //Check if the submit button has been clicked first if ( isset( $_POST['submit'] ) ){ //Check if user exists on database match_login($_POST['username'],$_POST['password']); } // Retrieve all active posts order by lastest first $resultarray = retrieve_active_posts(); echo '&lt;div id="content-wrap"&gt;'; foreach($resultarray AS $value){ $filename = substr($value['img_file_name'],9); $cat_id = $value['cat_id']; echo '&lt;article class="post"&gt;'; echo '&lt;div class="post_title"&gt;' . $value['post_title'] . '&lt;/div&gt;'; echo '&lt;div class="post_info"&gt;' . 'Category: ' . $cat_name = get_cat_name($cat_id) .'&lt;br /&gt;'. 'Year: ' . $value['post_year'] .'&lt;br /&gt;'. $value['post_desc'] .'&lt;br /&gt;'. '&lt;/div&gt;'; echo '&lt;div class="link-to-post"&gt;&lt;a href="#"&gt;Click to view&lt;/a&gt;&lt;/div&gt;'; echo '&lt;a href="#'.$value['post_id'].'" class="linktopost"&gt;&lt;img class="post-thumb" src="img/thumb_/'.$filename.'" alt="MJbox Michael Jackson memorabilia thumbnail" data-postid="'.$value['post_id'].'"/&gt;&lt;/a&gt;'; echo '&lt;a href="#'.$value['post_id'].'" class="linktopost"&gt;&lt;img class="cover-img" src="img/post-bg-1.png" alt="test" data-postid="'.$value['post_id'].'"/&gt;&lt;/a&gt;'; echo '&lt;/article&gt;'; } echo '&lt;/div&gt;'; </code></pre> <p>and some of my functions.php file including line 29: </p> <pre><code>//Check if user is logged in function loggedin(){ //Check if the loggedin status is set to true, meaning that user is logged in. if ( isset ( $_SESSION['loggedin'] ) &amp;&amp; $_SESSION['loggedin'] == true ) { return true; }else{ return false; } } //Check users login details function match_login($username, $password){ //If the button has been clicked get the variables //test the connection try{ //connect to the database $dbh = new PDO("mysql:host=correct;dbname=correct","correct", "correct"); //if there is an error catch it here } catch( PDOException $e ) { //display the error echo $e-&gt;getMessage(); } //select any username and password that match $stmt = $dbh-&gt;prepare("SELECT * FROM mjbox_users WHERE username=? AND password=?"); $stmt-&gt;bindParam(1, $username); $stmt-&gt;bindParam(2, $password); //execute the select statement, put in if statement to provide error if false!? if( $stmt-&gt;execute() ){ //count how many rows are found $numrows = $stmt-&gt;rowCount(); //if there is a match continue if( $numrows &gt; 0 ){ $_SESSION['loggedin'] = true; $_SESSION['username'] = $username; header( 'Location: index.php' ) ; echo 'yes'; } } $dbh = null; } //logout function logout(){ $_SESSION = array(); session_destroy(); header( 'Location: index.php' ) ; } </code></pre> <p>This is line 29:</p> <pre><code>$stmt = $dbh-&gt;prepare("SELECT * FROM mjbox_users WHERE username=? AND password=?"); </code></pre> <p>What might be causing the connection to fail and the fatal error?</p> </div>

Centos7 二进制方式安装mysql5.7.17 安装完成后启动报错

[root@localhost init.d]# service mysqld start Starting MySQL.Logging to '/usr/local/mysql/data/localhost.localdomain.err'. ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid). [root@localhost init.d]# 在线等。。。。

CentOS 下执行安装rpm的问题

在CentOS系统下,用tommy账号,执行安装rpm文件时,提示:error:can't create transaction lock on /var/lib/rpm/.rpm.lock(permission denied), 我已经把这个账号改在了root组了,已经修改文件修改/etc/sudoers 中内容: %wheel ALL=(ALL) ALL #usermod -g root tommy

centos7上用rpmbuild建立rpm安装包问题(急)

centos7.1 php-5.6.25 $ ls rpmbuild/ BUILD BUILDROOT RPMS SOURCES SPECS SRPMS $cat rpmbuild/SPECS/php.spec Name: php Version: 5.6.25 Release: 1%{?dist} Summary: compiled from 5.6.25 by Kevin Group: System Environment/Daemons License: GPL URL: https://secure.php.net Source0: php-5.6.25.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: gcc, gcc-c++, openssl-devel Requires: wireshark-gnome %description php server. Compiled from 5.6.25 by Kevin %prep %setup -q %build ./configure '--with-libdir=lib64' '--prefix=/usr/local/php5.6' '--with-fpm-systemd' '--enable-fpm' '--enable-mbstring' '--with-mysql' '--with-mysqli' '--with-pdo-mysql' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir' '--with-curl' '--with-openssl' '--with-mcrypt' '--enable-zip' '--enable-intl' make %{?_smp_mflags} %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %defattr(-,root,root,-) /usr/local/php5.6/bin/* /usr/local/php5.6/sbin/* /usr/local/php5.6/include/* /usr/local/php5.6/php/php/fpm/* /usr/local/php5.6/php/man/man1/* /usr/local/php5.6/php/man/man8/* /usr/local/php5.6/lib/php/* /usr/local/php5.6/lib/php/extensions/* /usr/local/php5.6/lib/php/extensions/no-debug-non-zts-20131226/* /usr/local/php5.6/lib/php/build/* /usr/local/php5.6/lib/php/build/shtool/* /usr/local/php5.6/lib/php/.registry/* /usr/local/php5.6/lib/php/.channels/* /usr/local/php5.6/lib/php/Archive/* /usr/local/php5.6/lib/php/doc/* /usr/local/php5.6/lib/php/doc/Archive_Tar/* /usr/local/php5.6/lib/php/doc/Archive_Tar/docs/* /usr/local/php5.6/lib/php/doc/Structures_Graph/* /usr/local/php5.6/lib/php/doc/Structures_Graph/docs/* /usr/local/php5.6/lib/php/doc/Structures_Graph/docs/tutorials/* /usr/local/php5.6/lib/php/doc/Structures_Graph/docs/tutorials/Structures_Graph/* /usr/local/php5.6/lib/php/doc/Structures_Graph/LICENSE/* /usr/local/php5.6/lib/php/doc/XML_Util/* /usr/local/php5.6/lib/php/doc/XML_Util/examples/* /usr/local/php5.6/lib/php/doc/PEAR/* /usr/local/php5.6/lib/php/doc/PEAR/LICENSE/* /usr/local/php5.6/lib/php/doc/PEAR/INSTALL/* /usr/local/php5.6/lib/php/Console/* /usr/local/php5.6/lib/php/test/* /usr/local/php5.6/lib/php/test/Console_Getopt/* /usr/local/php5.6/lib/php/test/Console_Getopt/tests/* /usr/local/php5.6/lib/php/test/Structures_Graph/* /usr/local/php5.6/lib/php/test/Structures_Graph/tests/* /usr/local/php5.6/lib/php/test/XML_Util/* /usr/local/php5.6/lib/php/test/XML_Util/tests/* /usr/local/php5.6/lib/php/Structures/* /usr/local/php5.6/lib/php/Structures/Graph/* /usr/local/php5.6/lib/php/Structures/Graph/Manipulator/* /usr/local/php5.6/lib/php/XML/* /usr/local/php5.6/lib/php/OS/* /usr/local/php5.6/lib/php/PEAR/* /usr/local/php5.6/lib/php/PEAR/ChannelFile/* /usr/local/php5.6/lib/php/PEAR/Command/* /usr/local/php5.6/lib/php/PEAR/Downloader/* /usr/local/php5.6/lib/php/PEAR/Frontend/* /usr/local/php5.6/lib/php/PEAR/Installer/* /usr/local/php5.6/lib/php/PEAR/Installer/Role/* /usr/local/php5.6/lib/php/PEAR/PackageFile/* /usr/local/php5.6/lib/php/PEAR/PackageFile/Generator/* /usr/local/php5.6/lib/php/PEAR/PackageFile/Parser/* /usr/local/php5.6/lib/php/PEAR/PackageFile/v2/* /usr/local/php5.6/lib/php/PEAR/REST/* /usr/local/php5.6/lib/php/PEAR/Task/* /usr/local/php5.6/lib/php/PEAR/Task/Postinstallscript/* /usr/local/php5.6/lib/php/PEAR/Task/Replace/* /usr/local/php5.6/lib/php/PEAR/Task/Unixeol/* /usr/local/php5.6/lib/php/PEAR/Task/Windowseol/* /usr/local/php5.6/lib/php/PEAR/Validator/* /usr/local/php5.6/lib/php/data/* /usr/local/php5.6/lib/php/data/PEAR/* %config /usr/local/php5.6/etc/* /usr/local/php5.6/var/run/* /usr/local/php5.6/lib/* %dir /usr/local/php5.6/var/log/ %post cp /usr/local/php5.6/etc/php-fpm.conf.default /usr/local/php5.6/etc/php-fpm.conf ln -s /usr/local/php5.6/bin/php /usr/bin/php %changelog * Tue Aug 30 2016 Kevin<kevin_liao@163.com> 5.6.25 - first rpm from php-5.6.25 然后用一个user用户为centos,没在root下执行 $ rpmbuild -ba rpmbuild/SPECS/php.spec 最后报错 Build complete. Don't forget to run 'make test'. + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.QjJHDq + umask 022 + cd /home/centos/rpmbuild/BUILD + '[' /home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 '!=' / ']' + rm -rf /home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 ++ dirname /home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 + mkdir -p /home/centos/rpmbuild/BUILDROOT + mkdir /home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 + cd php-5.6.25 + rm -rf /home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 + make install DESTDIR=/home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64 Installing shared extensions: /usr/local/php5.6/lib/php/extensions/no-debug-non-zts-20131226/ Installing PHP CLI binary: /usr/local/php5.6/bin/ Installing PHP CLI man page: /usr/local/php5.6/php/man/man1/ Installing PHP FPM binary: /usr/local/php5.6/sbin/ Installing PHP FPM config: /usr/local/php5.6/etc/ Installing PHP FPM man page: /usr/local/php5.6/php/man/man8/ Installing PHP FPM status page: /usr/local/php5.6/php/php/fpm/ Installing PHP CGI binary: /usr/local/php5.6/bin/ Installing PHP CGI man page: /usr/local/php5.6/php/man/man1/ Installing build environment: /usr/local/php5.6/lib/php/build/ Installing header files: /usr/local/php5.6/include/php/ Installing helper programs: /usr/local/php5.6/bin/ program: phpize program: php-config Installing man pages: /usr/local/php5.6/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php5.6/lib/php/ [PEAR] Archive_Tar - already installed: 1.4.0 [PEAR] Console_Getopt - already installed: 1.4.1 [PEAR] Structures_Graph- already installed: 1.1.1 [PEAR] XML_Util - already installed: 1.3.0 [PEAR] PEAR - already installed: 1.10.1 Wrote PEAR system config file at: /usr/local/php5.6/etc/pear.conf You may want to add: /usr/local/php5.6/lib/php to your php.ini include_path /home/centos/rpmbuild/BUILD/php-5.6.25/build/shtool install -c ext/phar/phar.phar /usr/local/php5.6/bin ln -s -f phar.phar /usr/local/php5.6/bin/phar Installing PDO headers: /usr/local/php5.6/include/php/ext/pdo/ + /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/centos/rpmbuild/BUILD/php-5.6.25 find: '/home/centos/rpmbuild/BUILDROOT/php-5.6.25-1.el7.centos.x86_64': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.QjJHDq (%install) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.QjJHDq (%install)

Ubuntu安装Mysql启动出错

小弟刚刚接触Linux,想安装一个mysql,按照这个步骤尝试安装[http://jingyan.baidu.com/article/4f7d5712d5f8181a2019270e.html](http://jingyan.baidu.com/article/4f7d5712d5f8181a2019270e.html ""),结果最后服务启动不了。 输入systemctl status mysql.service命令查看的时候显示 mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled) Active: deactivating (final-sigterm) (Result: exit-code) Process: 17564 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE) CGroup: /system.slice/mysql.service └─17566 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/my... Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.520393Z 0 [Note] ...d. Nov 20 06:51:35 ubuntu mysqld[17564]: mysqld: Table 'mysql.plugin' doesn't exist Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.520736Z 0 [ERROR]...t. Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.521871Z 0 [Warnin...d. Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.522009Z 0 [Warnin...ey Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.523079Z 0 [Note] ...06 Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.523154Z 0 [Note] ...e. Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.523182Z 0 [Note] ...'; Nov 20 06:51:35 ubuntu mysqld[17564]: 2016-11-20T14:51:35.523352Z 0 [Note] ...'. Nov 20 06:51:35 ubuntu systemd[1]: mysql.service: Control process exited, c...=1 Hint: Some lines were ellipsized, use -l to show in full. 输入journalctl -xe命令显示 -- Subject: Unit mysql.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysql.service has finished shutting down. Nov 20 07:10:32 ubuntu systemd[1]: Starting MySQL Community Server... -- Subject: Unit mysql.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysql.service has begun starting up. Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.122479Z 0 [Warning] TI Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.124201Z 0 [Note] /usr/ Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127834Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127858Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127864Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127869Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127874Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.127879Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.128131Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.128221Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.129445Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.139914Z 0 [Note] InnoD Nov 20 07:10:33 ubuntu mysqld[32270]: 2016-11-20T15:10:33.141532Z 0 [Note] InnoD 请各位大牛帮忙看看怎么回事,不胜感激!

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

立即提问
相关内容推荐